3 Commits

Author SHA1 Message Date
030e5bfd96 Update install/data/tarbad 2026-03-12 20:59:36 -04:00
099638c735 Merge pull request 'update tar' (#12) from 1.2-dev into main
Reviewed-on: #12
2026-03-12 20:55:22 -04:00
5172da1b5b Merge pull request '1.2-dev' (#11) from 1.2-dev into main
Reviewed-on: #11
2026-03-12 19:32:16 -04:00

View File

@@ -1,3 +1,4 @@
local function octal_to_number(str)
str = str:gsub("%z", ""):match("^%s*(.-)%s*$")
return tonumber(str, 8) or 0
@@ -97,16 +98,16 @@ local function unpack_tar(tarstr)
local pad = (512 - (size % 512)) % 512
i = i + size + pad
if name ~= "" then
if name == "" then goto continue end
local is_dir = typeflag == "5" or name:sub(-1) == "/"
local clean_name = name:gsub("/$", "")
if clean_name ~= "" then
local clean_name = name:gsub("/$", "")
if clean_name == "" then goto continue end
local parent_path = clean_name:match("(.+)/")
local fname = clean_name:match("([^/]+)$")
if not fname then
if not fname then goto continue end
local parent = root
if parent_path then
@@ -118,9 +119,8 @@ local function unpack_tar(tarstr)
else
parent[fname] = { __type = "file", __contents = contents }
end
end
end
end
::continue::
end
return flatten(root)