Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error upon encountering read-only directory within Zip file #352

Open
jvtoomey opened this issue Feb 8, 2025 · 3 comments · May be fixed by #353
Open

Error upon encountering read-only directory within Zip file #352

jvtoomey opened this issue Feb 8, 2025 · 3 comments · May be fixed by #353

Comments

@jvtoomey
Copy link

jvtoomey commented Feb 8, 2025

Summary

Running on iOS, if I have a zip file that has a read-only subfolder in it, and that subfolder has a file in it, it fails with the error:

You don’t have permission to save the file “Subfolder” in the folder

It doesn't happen if the subfolder in the zip file is read-write.
This seems similar to issue #52, except that I'm still encountering it with version 0.9.19.

Steps to Reproduce

Use the attached Xcode project. It has 2 zip files in its bundle that it will copy to the Library folder, where it does the extraction. Click the button labeled "click to unzip". It will copy the 2 zip filesReadOnly.zip and ReadWrite.zip from the Bundle to the Library directory. It will create the folders UnzipReadOnly and UnzipReadWrite. It will attempt to unzip them to their respective directories by calling unzipItem.

Expected Results

Both files should unzip.

Actual Results

The file ReadWrite.zip unzips fine. The file ReadOnly.zip will unzip the root directory in the zip file, but cannot proceed to the subfolder. You will see the errors
You don’t have permission to save the file “Subfolder” in the folder “ReadOnly”
and
Permission denied

Regression & Version

Using Xcode 15.4, ZipFoundation 0.9.19, iPhone 15 Simulator running iOS 17.5

zUnzipTest.zip

Related Link

@weichsel
Copy link
Owner

Hi @jvtoomey
Thanks for the sample - I can reproduce the issue but currently I don't have time to further investigate.
If you can provide a PR, I can have a look at it.

@jvtoomey
Copy link
Author

For sure, I'll try to burrow into it and see if I notice anything. I've never taken a crack at helping with an open-source project on GitHub before but I'll give it my best shot.

@jvtoomey jvtoomey linked a pull request Feb 10, 2025 that will close this issue
@jvtoomey
Copy link
Author

@weichsel I see that the test failed on iOS 16.0 ("xcrun: error: missing DEVELOPER_DIR path: /Applications/Xcode_16.0.app").
I'm guessing this is because I worked on the fork using Xcode 15.4? I can resubmit it using a newer Xcode if necessary. I did it on my work machine which isn't on the latest, but I can use my personal laptop which is on 16.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants