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

Don't convert entry.Name twice when accessing updateIndex #402

Merged

Conversation

AqlaSolutions
Copy link
Contributor

@AqlaSolutions AqlaSolutions commented Dec 14, 2019

I found out that deleting empty directory entry from ZipFile and then adding it back causes an exception while trying to add to updateIndex dictionary - because checking for existing element uses transformed entity.Name while adding uses its original value. Also directory name gets transformed as file name and ending slash gets removed therefore those too values are not same especially in directory case.
Entry.Name is already transformed file name so it shouldn't be transformed twice. So I replaced all such accesses to use entry.Name or transformed string-filename.

Fixes #82

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@Numpsy
Copy link
Contributor

Numpsy commented Dec 30, 2019

is this covering similar ground to #309? (haven't looked at the issue, just a query as they look to be changing similar things)

@piksel
Copy link
Member

piksel commented Dec 30, 2019

Yes, that PR was supposed to fix that issue, but it's been stale for almost a year.

@piksel piksel self-requested a review December 30, 2019 20:20
@piksel piksel added this to the v1.3 milestone Dec 30, 2019
Copy link
Member

@piksel piksel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general idea seems correct, but I'm not too found of the naming. Could you check the comments?

src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs Outdated Show resolved Hide resolved
src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs Outdated Show resolved Hide resolved
Accepted suggestion

Co-Authored-By: nils måsén <[email protected]>
@piksel piksel self-requested a review June 19, 2020 21:19
@piksel piksel self-assigned this Jun 19, 2020
@piksel piksel merged commit 24f948a into icsharpcode:master Aug 7, 2020
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.

Can not delete directory from zip archive bug
3 participants