From eb84b58d3c728be0834bb3bb39282346a41e6b1c Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 16 Aug 2018 16:00:30 +0100 Subject: [PATCH] webdav: Attempt to remove failed uploads Some webdav backends (eg rclone serve webdav) leave behind half written files on error. This causes the integration tests to fail. Here we remove the file if it exists. --- backend/webdav/webdav.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go index 9aed51139..25721a9c2 100644 --- a/backend/webdav/webdav.go +++ b/backend/webdav/webdav.go @@ -968,6 +968,8 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptio return shouldRetry(resp, err) }) if err != nil { + // Remove failed upload + _ = o.Remove() return err } // read metadata from remote