You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I try to unzip a file (using the FileManager extension) to a URL which was created with a relative path, the extraction fails with an error. Using the relative URL's absoluteURL does work.
Steps to Reproduce
Create a "relative" URL, such as: URL(fileURLWithPath: "../../Resources", isDirectory: true).
Pass that URL as the to parameter of FileManager.unzipItem (along with a URL to a valid zip file).
Expected Results
The contents of the zip file is successfully extracted to the target location.
Actual Results
An error is thrown. For example, if the zip file contains a compressed directory called "media", the error is:
The item couldn’t be opened because the file name “media” is invalid.
If I get the absoluteURL of the target URL first, it does work.
Regression & Version
Tested with 0.9.12.
Findings
I think this is caused because the implementation of URL.isContained(in:) (defined in FileManager+ZIP.swift) calls standardized on the URLs first, which outputs the wrong URL when it is created with a relative path. For example:
fileManager.changeCurrentDirectoryPath("/Users/Robert/Documents")
let relativePath = "../../David/Documents"
let relativeURL = URL(fileURLWithPath: relativePath)
relativeURL.absoluteString
// file:///Users/David/Documents
relativeURL.standardized.absoluteString
// file:///Users/Robert/Documents/David/Documents
The text was updated successfully, but these errors were encountered:
Extracting zip file is failing intermittently on latest release i.e 0.9.18. I was able to unzip with previous releases.
Do the archives you are trying to unzip contain symlinks that point outside of the destination directory? If so, you now have to opt-into pre-0.9.18 behavior by passing allowUncontainedSymlinks: true to unzipItem.
Do the archives you are trying to unzip contain symlinks that point outside of the destination directory? If so, you now have to opt-into pre-0.9.18 behavior by passing allowUncontainedSymlinks: true to unzipItem.
No, zip file does not contain symlinks. This is working fine with 0.9.17 and is seen on 0.9.18 and 0.9.19 versions.
We need to use 0.9.19 for Privacy manifest changes. Pls suggest how to resolve this issue.
Summary
If I try to unzip a file (using the FileManager extension) to a URL which was created with a relative path, the extraction fails with an error. Using the relative URL's
absoluteURL
does work.Steps to Reproduce
URL(fileURLWithPath: "../../Resources", isDirectory: true)
.to
parameter ofFileManager.unzipItem
(along with a URL to a valid zip file).Expected Results
The contents of the zip file is successfully extracted to the target location.
Actual Results
An error is thrown. For example, if the zip file contains a compressed directory called "media", the error is:
If I get the
absoluteURL
of the target URL first, it does work.Regression & Version
Tested with 0.9.12.
Findings
I think this is caused because the implementation of
URL.isContained(in:)
(defined in FileManager+ZIP.swift) callsstandardized
on the URLs first, which outputs the wrong URL when it is created with a relative path. For example:The text was updated successfully, but these errors were encountered: