Skip to content

feat: preserve internal folder structure when extracting RAR/7zip archives - #449

Merged
javi11 merged 2 commits into
mainfrom
feat/preserve-archive-internal-folder-structure
Mar 28, 2026
Merged

feat: preserve internal folder structure when extracting RAR/7zip archives#449
javi11 merged 2 commits into
mainfrom
feat/preserve-archive-internal-folder-structure

Conversation

@javi11

@javi11 javi11 commented Mar 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • RAR and 7zip archive extraction previously flattened all files into the virtual directory, discarding any subdirectory structure inside the archive
  • Now the internal path is preserved: Extras/bonus.mkv inside an archive lands at <virtualDir>/Extras/bonus.mkv
  • ISO-expanded files and single-file NZBs with rename_to_nzb_name remain flat (their filenames are synthetic, subdirs don't apply)
  • Windows-style backslash paths inside archives are normalised to forward slashes before the directory is created

Test plan

  • go test ./internal/importer/archive/rar/... ./internal/importer/archive/sevenzip/... — all existing and new tests pass
  • New TestProcessArchivePreservesInternalFolderStructure covers: flat files, subdir preservation, multiple files in same subdir, rename-flattening exception, and backslash normalisation
  • Import a RAR/7zip archive containing subdirectories and verify the virtual filesystem reflects the inner folder structure

javi11 and others added 2 commits March 28, 2026 19:31
…hives

Previously, files extracted from RAR and 7zip archives were placed flat
into the virtual directory, discarding any subdirectories present inside
the archive. Now the internal path structure is preserved so that e.g.
Extras/bonus.mkv inside an archive lands at <virtualDir>/Extras/bonus.mkv.

ISO-expanded files and single-file NZBs with rename-to-NZB-name are
exempt and continue to be placed flat, as their filenames are synthetic.

Adds table-driven tests for both RAR and 7zip aggregators covering flat
files, subdirectory preservation, multi-file subdirs, rename flattening,
and Windows-style backslash path normalisation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javi11
javi11 merged commit d22ce2a into main Mar 28, 2026
2 checks passed
yoshitaka420 pushed a commit to yoshitaka420/altmount that referenced this pull request Jun 1, 2026
…hives (kipsilabs#449)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant