Skip to content

Conversation

@Lamparter
Copy link
Contributor

Resolved / Related Issues

Steps used to test these changes

  1. Opened Files
  2. Create an archive in a directory using tar --exclude=archive.tar -cf archive.tar . in Powershell
  3. Do the 'Extract (smart)' action on the newly created tar archive
  4. See that the folder '.' in the archive gets renamed to the archive name 'archive'

Copilot AI review requested due to automatic review settings January 17, 2026 12:12
@Lamparter Lamparter changed the title Fix "." and ".." in archives being extracted wrong Fix: Fixed an issue where archives with reserved item names wouldn't extract correctly Jan 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where "." and ".." directory entries in archives were being incorrectly treated as meaningful top-level items during smart extraction. The fix ensures that when using "Extract (smart)" on archives containing "." (current directory) or ".." (parent directory) entries, these special directory references are properly ignored when determining whether to create a subfolder.

Changes:

  • Refactored the logic for detecting multiple top-level items in archives to filter out "." and ".." entries
  • Introduced a new helper function GetFirstMeaningfulSegment that skips special directory references when parsing archive entry paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +100 to +105
foreach (var part in parts)
{
if (part is "." or "..")
continue;
return part;
}
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

This foreach loop implicitly filters its target sequence - consider filtering the sequence explicitly using '.Where(...)'.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what this means.

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.

Bug: Smart extracting a .tar file with "." as the only directory in root is not properly handled

1 participant