diff --git a/backend/compress/compress.go b/backend/compress/compress.go index b0ada83c6..6429e5a7e 100644 --- a/backend/compress/compress.go +++ b/backend/compress/compress.go @@ -373,7 +373,10 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) { } // Create our Object o, err := f.Fs.NewObject(ctx, makeDataName(remote, meta.CompressionMetadata.Size, meta.Mode)) - return f.newObject(o, mo, meta), err + if err != nil { + return nil, err + } + return f.newObject(o, mo, meta), nil } // checkCompressAndType checks if an object is compressible and determines it's mime type @@ -677,7 +680,7 @@ func (f *Fs) putWithCustomFunctions(ctx context.Context, in io.Reader, src fs.Ob } return nil, err } - return f.newObject(dataObject, mo, meta), err + return f.newObject(dataObject, mo, meta), nil } // Put in to the remote path with the modTime given of the given size @@ -1097,6 +1100,9 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op origName := o.Remote() if o.meta.Mode != Uncompressed || compressible { newObject, err = o.f.putWithCustomFunctions(ctx, in, o.f.wrapInfo(src, origName, src.Size()), options, o.f.Fs.Put, updateMeta, compressible, mimeType) + if err != nil { + return err + } if newObject.Object.Remote() != o.Object.Remote() { if removeErr := o.Object.Remove(ctx); removeErr != nil { return removeErr @@ -1110,9 +1116,9 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op } // If we are, just update the object and metadata newObject, err = o.f.putWithCustomFunctions(ctx, in, src, options, update, updateMeta, compressible, mimeType) - } - if err != nil { - return err + if err != nil { + return err + } } // Update object metadata and return o.Object = newObject.Object