union: fix duplicated files when using directories with leading /

See: https://forum.rclone.org/t/union-backend-copying-to-all-remotes-while-it-shouldnt/31781
This commit is contained in:
Nick Craig-Wood 2022-07-09 21:13:06 +01:00
parent 55bbff6346
commit 0ee0812a2b

View File

@ -834,6 +834,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
} }
} }
root = strings.Trim(root, "/")
upstreams := make([]*upstream.Fs, len(opt.Upstreams)) upstreams := make([]*upstream.Fs, len(opt.Upstreams))
errs := Errors(make([]error, len(opt.Upstreams))) errs := Errors(make([]error, len(opt.Upstreams)))
multithread(len(opt.Upstreams), func(i int) { multithread(len(opt.Upstreams), func(i int) {