zip-rs / zip-old

Zip implementation in Rust
MIT License
731 stars 204 forks source link

Path separator handling on Windows #439

Closed mistydemeo closed 5 months ago

mistydemeo commented 6 months ago

It looks like the ZIP format expects to always get / as path separators, so passing in Windows paths without normalization produces some broken/unexpected ZIP files. It looks like in #103 this was fixed by adding start_file_from_path and add_directory_from_path, but they were deprecated without replacement in #182. Is the recommended approach for users to normalize all paths to Unix file separators before passing the filenames in to write_file or add_directory?

Pr0methean commented 6 months ago

Per APPNOTE:

4.4.17.1 The name of the file, with optional relative path. The path stored MUST not contain a drive or device letter, or a leading slash. All slashes MUST be forward slashes '/' as opposed to backwards slashes '\' for compatibility with Amiga and UNIX file systems etc. If input came from standard input, there is no file name field.

Pr0methean commented 6 months ago

Version 1.1.1 will undeprecate start_file_from_path and add_directory_from_path and add other Path-based methods. It also normalizes . and ...

Pr0methean commented 6 months ago

@mistydemeo Could you please confirm that version 1.1.1 works for you, and then close this issue? I can't do so myself because I'm still waiting on @Plecra to add me as a repo admin.

mistydemeo commented 5 months ago

Oh, sure! What's the situation with the transfer of ownership? I was surprised to see crates.io updated to point at a new git repo without much comment, or a note in this repo.

Pr0methean commented 5 months ago

That note is coming in https://github.com/zip-rs/zip/pull/447. @Plecra made me a co-owner of the crate and a member of the zip-rs organization, but I'm also asking them to make me an admin of this repo so that I can change the name to zip-old, close the currently-open issues and PRs as I copy them to my repo or release fixes for them (even if the requester is no longer available the way you are), and then archive this repo once all issues and PRs are closed.