Skip to content

fix(archive): create the destination dir before decompressing into it - #9683

Open
soujasK wants to merge 1 commit into
AlistGo:mainfrom
soujasK:fix/archive-decompress-dst-dir
Open

soujasK wants to merge 1 commit into
AlistGo:mainfrom
soujasK:fix/archive-decompress-dst-dir

Conversation

@soujasK

@soujasK soujasK commented Oct 28, 2026

Copy link
Copy Markdown

op.ArchiveDecompress reads the destination directory with GetUnwrap before making sure it exists. For drivers that decompress server-side (115 Open, Cloudreve v4, Doubao, Alias, AList v3, ...), extracting an archive within the same storage into a nested path that doesn't exist yet fails with object not found. When the destination is on another storage, or the driver doesn't decompress server-side, fs.archiveDecompress falls back to the download-and-upload task, which goes through MakeDir/Put and creates the directory, so the same request behaves differently depending on the driver.

This is the gap #9662 and #9668 fixed for Copy and Move. This adds the same MakeDir call after the source object is resolved. MakeDir is recursive and a no-op for an existing directory, so nothing changes for existing paths.

Test: internal/op/archive_test.go registers a test driver that embeds Local and implements driver.ArchiveDecompress (it writes a fixed file into the destination), then decompresses into /a/b, which doesn't exist yet. It fails on main with object not found and passes with this change. It follows the same Local storage setup as the Copy and Move tests in fs_test.go.

Ran go test ./internal/op/ (whole package ok) on go1.27 linux/amd64.

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