1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-16 00:00:05 +01:00

Adding check for uploaded status in b2.Load() and b2.Test().

This commit is contained in:
Joe Turgeon 2016-12-18 17:39:46 -06:00
parent 4157af999f
commit 591f51c72e
No known key found for this signature in database
GPG key ID: 7B63B97D65DC695F

View file

@ -72,8 +72,9 @@ func (be b2) Load(h restic.Handle, p []byte, off int64) (n int, err error) {
return 0, errors.Wrap(err, "bucket.Object")
}
// Ensure object attributes are loaded and status is uploaded.
info, err := obj.Attrs(be.context)
if err != nil {
if err != nil || info == nil || info.Status != blazerb2.Uploaded {
return 0, errors.Wrap(err, "obj.Attrs")
}
@ -185,8 +186,8 @@ func (be *b2) Test(t restic.FileType, name string) (bool, error) {
found := false
objName := be.b2path(t, name)
obj := be.bucket.Object(objName)
_, err := obj.Attrs(be.context)
if err == nil {
info, err := obj.Attrs(be.context)
if err == nil && info != nil && info.Status == blazerb2.Uploaded {
found = true
}
return found, nil