mirror of
https://github.com/restic/restic.git
synced 2024-12-23 00:07:25 +00:00
Merge pull request #3249 from MichaelEischer/fix-dropped-gs-error
gs: Don't drop error when finishing upload
This commit is contained in:
commit
dd94efb307
2 changed files with 11 additions and 1 deletions
7
changelog/unreleased/pull-3249
Normal file
7
changelog/unreleased/pull-3249
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Bugfix: Better error handling for gs backend
|
||||||
|
|
||||||
|
The gs backend did not notice when the last steep of completing a file upload
|
||||||
|
failed. Under rare circumstance, this might be able to cause missing files in
|
||||||
|
the backup repository. This has been fixed.
|
||||||
|
|
||||||
|
https://github.com/restic/restic/pull/3249
|
|
@ -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 := be.bucket.Object(objName).NewWriter(ctx)
|
||||||
w.ChunkSize = 0
|
w.ChunkSize = 0
|
||||||
wbytes, err := io.Copy(w, rd)
|
wbytes, err := io.Copy(w, rd)
|
||||||
w.Close()
|
cerr := w.Close()
|
||||||
|
if err == nil {
|
||||||
|
err = cerr
|
||||||
|
}
|
||||||
|
|
||||||
be.sem.ReleaseToken()
|
be.sem.ReleaseToken()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue