mirror of
https://github.com/rclone/rclone
synced 2024-11-25 02:47:14 +01:00
cache: Fix Server Side Copy with Temp Upload
When wrapping a backend that supports Server Side Copy (e.g. `b2`, `s3`) and configuring the `tmp_upload_path` option, the `cache` backend would erroneously report that Server Side Copy/Move was not supported, causing operations such as file moves to fail. This change fixes this issue under these circumstances such that Server Side Copy will now be used when the wrapped backend supports it. Fixes #3206
This commit is contained in:
parent
fb169a8b54
commit
19ff7c9302
6
backend/cache/cache.go
vendored
6
backend/cache/cache.go
vendored
@ -520,9 +520,6 @@ func NewFs(name, rootPath string, m configmap.Mapper) (fs.Fs, error) {
|
||||
// override only those features that use a temp fs and it doesn't support them
|
||||
//f.features.ChangeNotify = f.ChangeNotify
|
||||
if f.opt.TempWritePath != "" {
|
||||
if f.tempFs.Features().Copy == nil {
|
||||
f.features.Copy = nil
|
||||
}
|
||||
if f.tempFs.Features().Move == nil {
|
||||
f.features.Move = nil
|
||||
}
|
||||
@ -1533,6 +1530,9 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
||||
fs.Errorf(src, "source remote (%v) doesn't support Copy", src.Fs())
|
||||
return nil, fs.ErrorCantCopy
|
||||
}
|
||||
if f.opt.TempWritePath != "" && src.Fs() == f.tempFs {
|
||||
return nil, fs.ErrorCantCopy
|
||||
}
|
||||
// the source must be a cached object or we abort
|
||||
srcObj, ok := src.(*Object)
|
||||
if !ok {
|
||||
|
@ -59,7 +59,7 @@ Note to run these commands on a running backend then see
|
||||
[backend/command](/rc/#backend/command) in the rc docs.
|
||||
`,
|
||||
RunE: func(command *cobra.Command, args []string) error {
|
||||
cmd.CheckArgs(2, 1E6, command, args)
|
||||
cmd.CheckArgs(2, 1e6, command, args)
|
||||
name, remote := args[0], args[1]
|
||||
cmd.Run(false, false, command, func() error {
|
||||
// show help if remote is a backend name
|
||||
|
Loading…
Reference in New Issue
Block a user