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:
parent
4157af999f
commit
591f51c72e
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue