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:
@@ -1,3 +1,5 @@
|
|||||||
|
/// <reference types="bun-types" />
|
||||||
|
|
||||||
import { describe, expect, it } from "bun:test"
|
import { describe, expect, it } from "bun:test"
|
||||||
|
|
||||||
import { parseZipInfoListedEntry } from "./zipinfo-zip-entry-listing"
|
import { parseZipInfoListedEntry } from "./zipinfo-zip-entry-listing"
|
||||||
@@ -7,7 +9,7 @@ describe("parseZipInfoListedEntry", () => {
|
|||||||
it("#when parsing the line #then preserves the original trailing whitespace", () => {
|
it("#when parsing the line #then preserves the original trailing whitespace", () => {
|
||||||
// given
|
// given
|
||||||
const listedLine =
|
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
|
// when
|
||||||
const parsedEntry = parseZipInfoListedEntry(listedLine)
|
const parsedEntry = parseZipInfoListedEntry(listedLine)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { readZipSymlinkTarget } from "./read-zip-symlink-target"
|
|||||||
|
|
||||||
export function parseZipInfoListedEntry(line: string): ArchiveEntry | null {
|
export function parseZipInfoListedEntry(line: string): ArchiveEntry | null {
|
||||||
const match = line.match(
|
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) {
|
if (!match) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user