1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

storj: fix uploading to the wrong object on Update with overriden remote name

In this commit we discovered a problem with objects being uploaded to
the incorrect object name. It added an integration test for the
problem.

65b2e378e0 drive: fix incorrect remote after Update on object

This test was tripped by the Storj backend and this patch fixes the
problem.
This commit is contained in:
Nick Craig-Wood
2023-06-27 12:46:55 +01:00
parent 4b4198522d
commit 389565f5e2
2 changed files with 11 additions and 7 deletions

View File

@@ -176,9 +176,9 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (_ io.ReadC
// But for unknown-sized objects (indicated by src.Size() == -1), Upload should either
// return an error or update the object properly (rather than e.g. calling panic).
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {
fs.Debugf(o, "cp input ./%s %+v", src.Remote(), options)
fs.Debugf(o, "cp input ./%s %+v", o.Remote(), options)
oNew, err := o.fs.Put(ctx, in, src, options...)
oNew, err := o.fs.put(ctx, in, src, o.Remote(), options...)
if err == nil {
*o = *(oNew.(*Object))