From 629b7eacd85e8988db9deb9f6df65a962310dbe8 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 2 Aug 2019 17:20:45 +0100 Subject: [PATCH] b2: fix integration tests after accounting changes In 53a1a0e3efb2cf04 we started returning non nil from NewObject when an object isn't found. This breaks the integration tests and the API expected of a backend. This fixes it. --- backend/b2/b2.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/b2/b2.go b/backend/b2/b2.go index 49882dbba..eb550d5cc 100644 --- a/backend/b2/b2.go +++ b/backend/b2/b2.go @@ -548,12 +548,12 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *api.Fil if info != nil { err := o.decodeMetaData(info) if err != nil { - return o, err + return nil, err } } else { err := o.readMetaData(ctx) // reads info and headers, returning an error if err != nil { - return o, err + return nil, err } } return o, nil @@ -1082,7 +1082,8 @@ func (f *Fs) purge(ctx context.Context, oldOnly bool) error { for object := range toBeDeleted { oi, err := f.newObjectWithInfo(ctx, object.Name, object) if err != nil { - fs.Errorf(object, "Can't create object %+v", err) + fs.Errorf(object.Name, "Can't create object %v", err) + continue } tr := accounting.Stats(ctx).NewCheckingTransfer(oi) err = f.deleteByID(object.ID, object.Name)