Repository navigation
fix(move): create the destination dir before moving into it - #9668
Merged
Merged
Conversation
Move did not ensure the destination directory exists before it read it, so a move inside the same storage into a nested path that does not exist yet failed with failed to get dst dir. Copy got the same MakeDir call in 9662 and cross storage moves already create the dir through Put, so Move was the last path left behind. i added the MakeDir call to the Move prologue and a test that moves a file into a nested directory that does not exist yet
skysliences
previously approved these changes
Oct 12, 2026
Author
|
thanks for the approval @skysliences, glad the move fix looks right to you |
JoaHuang
previously approved these changes
Oct 13, 2026
JoaHuang
approved these changes
Oct 13, 2026
skysliences
approved these changes
Oct 13, 2026
Author
|
thanks for the review and merge @JoaHuang @okatu-loli, happy to contribute to alist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(move): create the destination dir before moving into it
Move read the destination directory before it made sure it exists, so a move inside the same storage into a nested path that does not exist yet failed with failed to get dst dir. Copy got the same MakeDir call in #9662 and cross storage moves already create the dir through Put, so Move was the last path left behind. MakeDir is recursive and a no op when the dir is already there, so nothing changes for existing paths.
i added the MakeDir call to the Move prologue and a test that moves a file into a nested directory that does not exist yet. the test fails on main with failed to get dst dir and passes with the change. it sits next to the Copy test from #9662 and uses the same Local storage test setup.
ran go test ./internal/op/ (whole package ok), go vet ./internal/op/ (clean) and gofmt (clean) on go1.27.0 linux amd64
Overlap with open PR #9664
#9664 (
fix(quark): preserve post-upload identity across stale listings) also edits theMoveprologue ininternal/op/fs.go. it hoistssrcDirPathabove theGetUnwrapcall while this patch adds theMakeDircall in the same spot, so the two touch the same few linesthey are independent and compose cleanly, keeping #9664's hoisted
srcDirPath/srcDirlines and thisMakeDirblock together is the whole resolution, a handful of lines in one function#9664 fixes a different defect, a post-upload recent-write cache for Quark and UC. it does not make
Movecreate a destination directory that does not exist yet, so this fix is still needed on its ownif #9664 lands first i am happy to rebase this on top of it, it should be a clean few line merge