From 93fee5bcf0e676a73d077d56182e7e7c2adbc777 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 9 Dec 2024 09:19:16 +0100 Subject: [PATCH] webdav: don't leave a partially uploaded file behind on error --- fs_local.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs_local.go b/fs_local.go index 0b9f7aa..65df148 100644 --- a/fs_local.go +++ b/fs_local.go @@ -132,9 +132,11 @@ func (fs LocalFileSystem) Create(ctx context.Context, name string, body io.ReadC defer wc.Close() if _, err := io.Copy(wc, body); err != nil { + os.Remove(p) return nil, false, err } if err := wc.Close(); err != nil { + os.Remove(p) return nil, false, err }