From 23e667ed247cee0fcd042a2c0a450df8eb9dc75d Mon Sep 17 00:00:00 2001 From: Iain Date: Sun, 4 Oct 2026 02:10:35 +0100 Subject: [PATCH] Fix split zip parts not found when the .ZIP is uppercase --- .../Archives/Zip/ZipArchiveVolumeFactory.cs | 2 +- tests/SharpCompress.Test/Zip/ZipArchiveTests.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/SharpCompress/Archives/Zip/ZipArchiveVolumeFactory.cs b/src/SharpCompress/Archives/Zip/ZipArchiveVolumeFactory.cs index ca2f0304..4e1fc8d7 100644 --- a/src/SharpCompress/Archives/Zip/ZipArchiveVolumeFactory.cs +++ b/src/SharpCompress/Archives/Zip/ZipArchiveVolumeFactory.cs @@ -21,7 +21,7 @@ internal static class ZipArchiveVolumeFactory part1.DirectoryName!, String.Concat( m.Groups[1].Value, - Regex.Replace(m.Groups[2].Value, @"[^xz]", ""), + Regex.Replace(m.Groups[2].Value.ToLowerInvariant(), @"[^xz]", ""), index.ToString(Constants.DefaultCultureInfo).PadLeft(2, '0') ) ) diff --git a/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs b/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs index ebee095a..52078ef7 100644 --- a/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs +++ b/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs @@ -148,6 +148,17 @@ public class ZipArchiveTests : ArchiveTests //uses first part to search for all parts and compares against this array ArchiveGetParts(new[] { "WinZip26.nocomp.multi.zipx", "WinZip26.nocomp.multi.zx01" }); + [Fact] + public void Zip_GetParts_UpperCaseZip() + { + var zip = Path.Combine(SCRATCH2_FILES_PATH, "MULTI.ZIP"); + var z01 = Path.Combine(SCRATCH2_FILES_PATH, "MULTI.z01"); + File.Copy(Path.Combine(TEST_ARCHIVES_PATH, "Infozip.nocomp.multi.zip"), zip); + File.Copy(Path.Combine(TEST_ARCHIVES_PATH, "Infozip.nocomp.multi.z01"), z01); + + Assert.Equal(new[] { zip, z01 }, ArchiveFactory.GetFileParts(zip)); + } + [Fact] public void Zip_GetPartsSplit() => //uses first part to search for all parts and compares against this array