diff --git a/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs b/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs index 003881988..f4f3028b5 100644 --- a/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs +++ b/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs @@ -1620,7 +1620,7 @@ private void AddUpdate(ZipUpdate update) { contentsEdited_ = true; - int index = FindExistingUpdate(update.Entry.Name); + int index = FindExistingUpdate(update.Entry.Name, isEntryName: true); if (index >= 0) { @@ -2529,13 +2529,9 @@ private void CopyEntryDataDirect(ZipUpdate update, Stream stream, bool updateCrc private int FindExistingUpdate(ZipEntry entry) { int result = -1; - string convertedName = entry.IsDirectory - ? GetTransformedDirectoryName(entry.Name) - : GetTransformedFileName(entry.Name); - - if (updateIndex_.ContainsKey(convertedName)) + if (updateIndex_.ContainsKey(entry.Name)) { - result = (int)updateIndex_[convertedName]; + result = (int)updateIndex_[entry.Name]; } /* // This is slow like the coming of the next ice age but takes less storage and may be useful @@ -2553,11 +2549,11 @@ private int FindExistingUpdate(ZipEntry entry) return result; } - private int FindExistingUpdate(string fileName) + private int FindExistingUpdate(string fileName, bool isEntryName = false) { int result = -1; - string convertedName = GetTransformedFileName(fileName); + string convertedName = !isEntryName ? GetTransformedFileName(fileName) : fileName; if (updateIndex_.ContainsKey(convertedName)) {