mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
[PR #988] [MERGED] Fix extraction failure on Windows due to case-sensitive path comparison #1407
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?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/988
Author: @Copilot
Created: 10/28/2025
Status: ✅ Merged
Merged: 10/28/2025
Merged by: @adamhathcock
Base:
master← Head:copilot/fix-file-write-error📝 Commits (5)
ef2fee0Initial plan5392ca9Fix case-sensitive path comparison on Windows for file extractione111986Address code review feedback: use RuntimeInformation for platform detection150d9c3Complete fix for case-sensitive path comparison on Windows77d06fbMerge branch 'master' into copilot/fix-file-write-error📊 Changes
3 files changed (+116 additions, -17 deletions)
View changed files
📝
src/SharpCompress/Common/ExtractionMethods.cs(+14 -14)📝
src/SharpCompress/packages.lock.json(+3 -3)➕
tests/SharpCompress.Test/ExtractionTests.cs(+99 -0)📄 Description
Path.GetFullPath()on Windows can return paths with different casing than what's on disk (e.g.,system32vsSystem32under LocalSystem account). The security check validating extraction paths was using case-sensitive comparison, causing false positives that blocked legitimate extractions.Changes:
PathComparisonproperty returningStringComparison.OrdinalIgnoreCaseon Windows,StringComparison.Ordinalon UnixStringComparison.Ordinalin 4 path validation checks (sync + async methods)RuntimeInformation.IsOSPlatform(OSPlatform.Windows)for platform detectionExample:
Path traversal security checks remain fully functional.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.