mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
the zip file with '\\' in it's entry.Key make error when run in linux #755
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jackletter on GitHub (Jan 7, 2026).
Although the zip specification stipulates that file path names should use '/' as the separator, there are still non-compliant writes that can cause issues when extracting on Linux. Could we consider uniformly replacing '' with '/' after decoding?
Additional note: I tried implementing the replacement in the CustomDecoder, but if the zip file specifies an encoding, SharpCompress won't invoke the CustomDecoder, preventing me from making the corrections.
@adamhathcock commented on GitHub (Jan 7, 2026):
It something making a zip with
\in the path in SharpCompress? If something is doing this, I don't want to account for it with code.Maybe the encoding method should have more options?
@jackletter commented on GitHub (Jan 7, 2026):
Users may use various programs to compress ZIP file packages, which is beyond our control. As a service provider, we must strive to be as compatible as possible with users' files. @adamhathcock
@jackletter commented on GitHub (Jan 7, 2026):
The simplest approach is to make the ArchiveEncoding.DecodeUTF8 method virtual. This way, I can inherit from ArchiveEncoding and override DecodeUTF8 to internally replace '\' with '/'.
@adamhathcock commented on GitHub (Jan 7, 2026):
Disagree. Keys are dumb strings and whatever produces should confirm to spec. If the programs don't, it's not up to SharpCompress to fix it. People can do things themselves with SC though.
It is the simplest, however might not be the best.
@jackletter commented on GitHub (Jan 7, 2026):
So please merge the pull request, so I won't have to duplicate SharpCompress source code internally.