mirror of
https://github.com/rclone/rclone.git
synced 2024-11-28 19:34:55 +01:00
fs: fix panic when using --metadata-mapper on large google doc files
Before this change, attempting to copy a large google doc while using the metadata mapper caused a panic. Google doc files use Rcat to download as they have an unknown size, and when the size of the doc file got above --streaming-upload-cutoff it used a object.NewStaticObjectInfo with a `nil` Fs to upload the file which caused the crash in the metadata mapper code. This change makes sure that the Fs in object.NewStaticObjectInfo is never nil, and it returns MemoryFs which is consistent with the Rcat code when the source is sized below the --streaming-upload-cutoff threshold. Fixes #7845
This commit is contained in:
parent
b059c96322
commit
488ed28635
@ -43,6 +43,9 @@ func NewStaticObjectInfo(remote string, modTime time.Time, size int64, storable
|
|||||||
info.hashes[ht] = ""
|
info.hashes[ht] = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if f == nil {
|
||||||
|
info.fs = MemoryFs
|
||||||
|
}
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ func TestStaticObject(t *testing.T) {
|
|||||||
o = object.NewStaticObjectInfo(remote, now, size, true, nil, nil)
|
o = object.NewStaticObjectInfo(remote, now, size, true, nil, nil)
|
||||||
_, err = o.Hash(context.Background(), hash.MD5)
|
_, err = o.Hash(context.Background(), hash.MD5)
|
||||||
assert.Equal(t, hash.ErrUnsupported, err)
|
assert.Equal(t, hash.ErrUnsupported, err)
|
||||||
|
assert.Equal(t, object.MemoryFs, o.Fs())
|
||||||
|
|
||||||
hs := map[hash.Type]string{
|
hs := map[hash.Type]string{
|
||||||
hash.MD5: "potato",
|
hash.MD5: "potato",
|
||||||
|
Loading…
Reference in New Issue
Block a user