forked from TrueCloudLab/rclone
b2: fix integration tests after accounting changes
In 53a1a0e3ef
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.
This commit is contained in:
parent
d3149acc32
commit
629b7eacd8
1 changed files with 4 additions and 3 deletions
|
@ -548,12 +548,12 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *api.Fil
|
||||||
if info != nil {
|
if info != nil {
|
||||||
err := o.decodeMetaData(info)
|
err := o.decodeMetaData(info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return o, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := o.readMetaData(ctx) // reads info and headers, returning an error
|
err := o.readMetaData(ctx) // reads info and headers, returning an error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return o, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return o, nil
|
return o, nil
|
||||||
|
@ -1082,7 +1082,8 @@ func (f *Fs) purge(ctx context.Context, oldOnly bool) error {
|
||||||
for object := range toBeDeleted {
|
for object := range toBeDeleted {
|
||||||
oi, err := f.newObjectWithInfo(ctx, object.Name, object)
|
oi, err := f.newObjectWithInfo(ctx, object.Name, object)
|
||||||
if err != nil {
|
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)
|
tr := accounting.Stats(ctx).NewCheckingTransfer(oi)
|
||||||
err = f.deleteByID(object.ID, object.Name)
|
err = f.deleteByID(object.ID, object.Name)
|
||||||
|
|
Loading…
Reference in a new issue