fix(zip): parse zipinfo file entries with preserved filenames

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-03 18:38:14 +09:00
parent e20b59cb29
commit 71b8110ff0
2 changed files with 4 additions and 2 deletions
@@ -1,3 +1,5 @@
/// <reference types="bun-types" />
import { describe, expect, it } from "bun:test"
import { parseZipInfoListedEntry } from "./zipinfo-zip-entry-listing"
@@ -7,7 +9,7 @@ describe("parseZipInfoListedEntry", () => {
it("#when parsing the line #then preserves the original trailing whitespace", () => {
// given
const listedLine =
"-rw-a-- 2.0 fat 4 b- defN 03-Apr-26 12:34 trailing-space.txt "
"?rw------- 2.0 unx 1 b- 1 stor 26-Apr-03 18:33 trailing-space.txt "
// when
const parsedEntry = parseZipInfoListedEntry(listedLine)
@@ -5,7 +5,7 @@ import { readZipSymlinkTarget } from "./read-zip-symlink-target"
export function parseZipInfoListedEntry(line: string): ArchiveEntry | null {
const match = line.match(
/^([dl-])\S*\s+\S+\s+\S+\s+\d+\s+\S+\s+\d+\s+\S+\s+\S+\s+\S+\s+(.*)$/
/^([-dl?])\S*\s+\S+\s+\S+\s+\d+\s+\S+\s+\d+\s+\S+\s+\S+\s+\S+\s+(.*)$/
)
if (!match) {
return null