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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
b6d72cce9f
commit
c24f6f5cde
@@ -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")
|
jsonErr(w, 400, "a folder can't be moved into itself")
|
||||||
return
|
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)
|
err = fsys.Rename(r.Context(), from, to)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Printf("files: move %s -> %s (from %s)", from, to, clientIP(r))
|
log.Printf("files: move %s -> %s (from %s)", from, to, clientIP(r))
|
||||||
|
|||||||
Reference in New Issue
Block a user