Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/RepoToolsCore/RepoActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ public enum RepoActions {
static func unzipTransaction(rootDir: String, fileName: String) -> String {
return "mkdir -p " + rootDir + " && " +
"cd " + rootDir + " && " +
"unzip -d OUT " + fileName + " > /dev/null && " +
"ditto -x -k --sequesterRsrc --rsrc " + fileName + " OUT > /dev/null && " +
"rm -rf " + fileName
}

Expand Down
24 changes: 24 additions & 0 deletions Tests/PodToBUILDTests/PodStoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ class PodStoreTests: XCTestCase {
XCTAssertTrue(shell.executed(encodedCommand: extract.0))
}

func testZipExtractionWithSpecialCharacteres() {
let hasDir = MakeShellInvocation("/bin/[", arguments: ["-e",
cacheRoot(forPod: "Charts", url: "https://github.com/danielgindi/Charts/archive/refs/tags/v4.0.1.zip"),
"]"], exitCode: 1)


let extract = MakeShellInvocation("/bin/sh",
arguments: ["-c", RepoActions.unzipTransaction(
rootDir: escape(extractDir),
fileName: escape(downloadPath)
)],
exitCode: 0)
let shell = LogicalShellContext(commandInvocations: [
hasDir,
extract
])

RepoActions.fetch(shell: shell, fetchOptions: fetchOpts)
XCTAssertTrue(shell.executed(encodedCommand:
LogicalShellContext.encodeDownload(url: URL(string: fetchOpts.url)!, toFile: downloadPath)
))
XCTAssertTrue(shell.executed(encodedCommand: extract.0))
}

func testCachedDownload() {
let hasDir = MakeShellInvocation("/bin/[", arguments: ["-e", cacheRoot(forPod: testPodName, url: "http://pinner.com/foo.zip"), "]"], value: 0)
let shell = LogicalShellContext(commandInvocations: [
Expand Down