From 030e5bfd96d39d398da5978cec648bd2ff999059 Mon Sep 17 00:00:00 2001 From: Astronand Date: Thu, 12 Mar 2026 20:59:36 -0400 Subject: [PATCH] Update install/data/tarbad --- install/data/tarbad | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/install/data/tarbad b/install/data/tarbad index d4cc91b..caa6983 100644 --- a/install/data/tarbad +++ b/install/data/tarbad @@ -1,3 +1,4 @@ + local function octal_to_number(str) str = str:gsub("%z", ""):match("^%s*(.-)%s*$") return tonumber(str, 8) or 0 @@ -97,30 +98,29 @@ 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 is_dir = typeflag == "5" or name:sub(-1) == "/" - local parent_path = clean_name:match("(.+)/") - local fname = clean_name:match("([^/]+)$") - if not fname then + local clean_name = name:gsub("/$", "") + if clean_name == "" then goto continue end - local parent = root - if parent_path then - parent = make_dirs(root, parent_path .. "/") - end - - if is_dir then - parent[fname] = parent[fname] or { __type = "dir", __entries = {} } - else - parent[fname] = { __type = "file", __contents = contents } - end - end - end + local parent_path = clean_name:match("(.+)/") + local fname = clean_name:match("([^/]+)$") + if not fname then goto continue end + + local parent = root + if parent_path then + parent = make_dirs(root, parent_path .. "/") end + + if is_dir then + parent[fname] = parent[fname] or { __type = "dir", __entries = {} } + else + parent[fname] = { __type = "file", __contents = contents } + end + + ::continue:: end return flatten(root)