forked from TrueCloudLab/rclone
compress: fix crash if metadata upload failed - fixes #5994
Before this changed the backend attempted to delete a nil object if the metadata upload failed.
This commit is contained in:
parent
8ee0fe9863
commit
71a784cfa2
1 changed files with 5 additions and 3 deletions
|
@ -626,9 +626,11 @@ func (f *Fs) putMetadata(ctx context.Context, meta *ObjectMetadata, src fs.Objec
|
||||||
// Put the data
|
// Put the data
|
||||||
mo, err = put(ctx, metaReader, f.wrapInfo(src, makeMetadataName(src.Remote()), int64(len(data))), options...)
|
mo, err = put(ctx, metaReader, f.wrapInfo(src, makeMetadataName(src.Remote()), int64(len(data))), options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
removeErr := mo.Remove(ctx)
|
if mo != nil {
|
||||||
if removeErr != nil {
|
removeErr := mo.Remove(ctx)
|
||||||
fs.Errorf(mo, "Failed to remove partially transferred object: %v", err)
|
if removeErr != nil {
|
||||||
|
fs.Errorf(mo, "Failed to remove partially transferred object: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue