mirror of
https://github.com/restic/restic.git
synced 2025-08-23 09:47:42 +00:00
gs: Don't drop error when finishing upload
The error returned when finishing the upload of an object was dropped. This could cause silent upload failures and thus data loss in certain cases. When a MD5 hash for the uploaded blob is specified, a wrong hash/damaged upload would return its error via the Close() whose error was dropped.
This commit is contained in:
@@ -235,7 +235,10 @@ func (be *Backend) Save(ctx context.Context, h restic.Handle, rd restic.RewindRe
|
||||
w := be.bucket.Object(objName).NewWriter(ctx)
|
||||
w.ChunkSize = 0
|
||||
wbytes, err := io.Copy(w, rd)
|
||||
w.Close()
|
||||
cerr := w.Close()
|
||||
if err == nil {
|
||||
err = cerr
|
||||
}
|
||||
|
||||
be.sem.ReleaseToken()
|
||||
|
||||
|
Reference in New Issue
Block a user