Another fix handling of UTF-8 filenames #103
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #84
This PR continues on the work of @cerisola in #85
And incorporates requested changes from @fhs
I have added
os :: UInt8
andexternalattrs :: UInt32
fields to bothReadableFile
andWritableFile
.As noted in #85, these need to be modified from zero to get proper UTF-8 support.
I am setting
os
to0x03
andexternalattrs
toUInt32(UInt32(0o0100644) << 16)
by default inaddfile
.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)