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

Another fix handling of UTF-8 filenames #103

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nhz2
Copy link

@nhz2 nhz2 commented Apr 30, 2023

Fixes #84

This PR continues on the work of @cerisola in #85
And incorporates requested changes from @fhs

I have added os :: UInt8 and externalattrs :: UInt32 fields to both ReadableFile and WritableFile.
As noted in #85, these need to be modified from zero to get proper UTF-8 support.

I am setting os to 0x03 and externalattrs to UInt32(UInt32(0o0100644) << 16) by default in addfile.
This will mark files as mode 0o644

https://github.com/madler/zipflow/blob/2bef2123ebe519c17b18d2d0c3c71065088de952/zipflow.c#L752
also adds the 0o0100000 to specify the file is a regular file, as described in https://unix.stackexchange.com/a/14727

This default mode also matches the Tar.jl default: https://github.com/JuliaIO/Tar.jl#permissions

To get back the previous behavior, do for example f = ZipFile.addfile(w, "julia.txt"; os=0x00, externalattrs=0x00000000)

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 this pull request may close these issues.

Issue when creating zip file with Unicode filenames inside
1 participant