mirror of
https://github.com/1f349/go-webdav.git
synced 2025-01-30 19:26:31 +00:00
webdav: don't leave a partially uploaded file behind on error
This commit is contained in:
parent
7f8c17ad71
commit
93fee5bcf0
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user