From c24f6f5cdeed4b49b51f395408f8c00f8bc6236b Mon Sep 17 00:00:00 2001 From: Mitchell-Johnson Date: Sun, 11 Oct 2026 16:30:04 -0700 Subject: [PATCH] Files: a move of something that isn't there is a 404, not a task that fails on arrival The kernel answers EXDEV for two paths on different filesystems before it looks for the source, so the cross-filesystem path was taken for a missing file. Co-Authored-By: Claude Fable 5.1 --- internal/api/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/api/server.go b/internal/api/server.go index 722ae59..edc7b69 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -2088,6 +2088,12 @@ func (s *Server) filesMove(w http.ResponseWriter, r *http.Request) { jsonErr(w, 400, "a folder can't be moved into itself") return } + // The kernel answers EXDEV for two paths on different filesystems before it looks for + // the source, so a missing file would otherwise become a task that fails on arrival. + if _, err := fsys.Stat(r.Context(), from); err != nil { + fsErr(w, err) + return + } err = fsys.Rename(r.Context(), from, to) if err == nil { log.Printf("files: move %s -> %s (from %s)", from, to, clientIP(r))