-
Notifications
You must be signed in to change notification settings - Fork 976
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
Invalid Characters in Zip throws exception #341
Comments
Version 1.10? I'm guessing it's 1.1.0? |
Confirmed with the current source using a zip file which contains a file that has question marks in the name - it throws a System.ArgumentException from Path.IsPathRooted. Given that the comments on the CleanName function talk about converting names into zip formats, doesn't sound like something that should be called on extraction?
|
Agreed. It should at least be platform-specific, but then again, we could just let the file system throw the exception on invalid file names instead. |
There's a bunch of functionality in the NameTransform bits for processing invalid characters and such that the caller and/or container could use rather than ZipEntry doing it, including some alternate path root handling code that CleanName could possibly use instead of IsPathRooted if required? Related: Most of the Add() functions on ZipFile create ZipEntrys using the EntryFactory, which runs the names through NameTransform, but the variants that actually take ZipEntries don't. |
Yeah, now with #362 closed, we will be able to read out-of-spec files, but it also makes it possible to create them. We should at least make sure that that's not done accidentally, and use |
Looks like the 'WriteZipStreamWithNoCompression' unit test you added for #406 has been broken by the transform/clean change? Something like Numpsy@4e7b20b might work to transform the names when adding entries to ZipOutputStream, not sure how the instances need to be managed though (Might ZipOutputStream need a NameTransform property similar to the one on ZipFile?) |
Saying that, making zip output stream do a transform itself would also have a knock on effect in FastZip (e.g. #275) - not sure how the interactions should work there. |
Hopefully resolved now? |
Yeah! |
Steps to reproduce
Exception is thrown.
Expected behavior
SharpZipLib should not load a ZipFile class and try to clean up the entry filenames before returning them to the user. The user should be responsible for cleaning up entries themselves in whatever method they see fit.
Actual behavior
SharpZipLib throws an exception in ZipEntry line 1303 because IsPathRooted checks for invalid characters. It also removes root path names.
Version of SharpZipLib
1.10
Obtained from (only keep the relevant lines)
For now I worked around the issues by removing the CleanName function from ZipEntry in my own local copy.
The text was updated successfully, but these errors were encountered: