Skip to content

fix(move): create the destination dir before moving into it - #9668

Merged
okatu-loli merged 2 commits into
AlistGo:mainfrom
hktitof:fix/move-create-dst-dir
Oct 13, 2026
Merged

okatu-loli merged 2 commits into
AlistGo:mainfrom
hktitof:fix/move-create-dst-dir

Conversation

@hktitof

@hktitof hktitof commented Oct 11, 2026

Copy link
Copy Markdown

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 the Move prologue in internal/op/fs.go. it hoists srcDirPath above the GetUnwrap call while this patch adds the MakeDir call in the same spot, so the two touch the same few lines

they are independent and compose cleanly, keeping #9664's hoisted srcDirPath / srcDir lines and this MakeDir block 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 Move create a destination directory that does not exist yet, so this fix is still needed on its own

if #9664 lands first i am happy to rebase this on top of it, it should be a clean few line merge

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
skysliences previously approved these changes Oct 12, 2026
@hktitof

hktitof commented Oct 12, 2026

Copy link
Copy Markdown
Author

thanks for the approval @skysliences, glad the move fix looks right to you

JoaHuang
JoaHuang previously approved these changes Oct 13, 2026
@okatu-loli
okatu-loli dismissed stale reviews from JoaHuang and skysliences via 4a153d4 October 13, 2026 01:50
@okatu-loli
okatu-loli merged commit ea628f9 into AlistGo:main Oct 13, 2026
15 checks passed
@hktitof

hktitof commented Oct 13, 2026

Copy link
Copy Markdown
Author

thanks for the review and merge @JoaHuang @okatu-loli, happy to contribute to alist

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.

4 participants