mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 18:43:50 +00:00
vfs: fix writing to a read only directory creating spurious directory entries
Before this fix, when a write to a read only directory failed, rclone
would leav spurious directory entries in the directory.
This confuses `rclone serve webdav` into giving this error
http: superfluous response.WriteHeader
This fixes the VFS layer to remove any directory entries where the
file creation did not succeed.
Fixes #5702
This commit is contained in:
committed by
Nick Craig-Wood
parent
fda06fc17d
commit
7771aaacf6
@@ -203,6 +203,11 @@ func (fh *WriteFileHandle) close() (err error) {
|
||||
if err == nil {
|
||||
fh.file.setObject(fh.o)
|
||||
err = writeCloseErr
|
||||
} else {
|
||||
// Remove vfs file entry when no object is present
|
||||
if fh.file.getObject() == nil {
|
||||
_ = fh.file.Remove()
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user