diff --git a/backend/union/policy/epall.go b/backend/union/policy/epall.go index 3f765c155..882a238f7 100644 --- a/backend/union/policy/epall.go +++ b/backend/union/policy/epall.go @@ -2,7 +2,7 @@ package policy import ( "context" - "path/filepath" + "path" "sync" "github.com/rclone/rclone/backend/union/upstream" @@ -21,7 +21,7 @@ type EpAll struct { EpFF } -func (p *EpAll) epall(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error) { +func (p *EpAll) epall(ctx context.Context, upstreams []*upstream.Fs, filePath string) ([]*upstream.Fs, error) { var wg sync.WaitGroup ufs := make([]*upstream.Fs, len(upstreams)) for i, u := range upstreams { @@ -29,7 +29,7 @@ func (p *EpAll) epall(ctx context.Context, upstreams []*upstream.Fs, path string i, u := i, u // Closure go func() { rfs := u.RootFs - remote := filepath.Join(u.RootPath, path) + remote := path.Join(u.RootPath, filePath) if findEntry(ctx, rfs, remote) != nil { ufs[i] = u } diff --git a/backend/union/policy/epff.go b/backend/union/policy/epff.go index dd7816ba7..e294cdadb 100644 --- a/backend/union/policy/epff.go +++ b/backend/union/policy/epff.go @@ -2,7 +2,7 @@ package policy import ( "context" - "path/filepath" + "path" "github.com/rclone/rclone/backend/union/upstream" "github.com/rclone/rclone/fs" @@ -16,13 +16,13 @@ func init() { // Given the order of the candidates, act on the first one found where the relative path exists. type EpFF struct{} -func (p *EpFF) epff(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error) { +func (p *EpFF) epff(ctx context.Context, upstreams []*upstream.Fs, filePath string) (*upstream.Fs, error) { ch := make(chan *upstream.Fs) for _, u := range upstreams { u := u // Closure go func() { rfs := u.RootFs - remote := filepath.Join(u.RootPath, path) + remote := path.Join(u.RootPath, filePath) if findEntry(ctx, rfs, remote) == nil { u = nil } diff --git a/backend/union/policy/newest.go b/backend/union/policy/newest.go index 1276955ad..8d4fa8049 100644 --- a/backend/union/policy/newest.go +++ b/backend/union/policy/newest.go @@ -2,7 +2,7 @@ package policy import ( "context" - "path/filepath" + "path" "sync" "time" @@ -20,7 +20,7 @@ type Newest struct { EpAll } -func (p *Newest) newest(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error) { +func (p *Newest) newest(ctx context.Context, upstreams []*upstream.Fs, filePath string) (*upstream.Fs, error) { var wg sync.WaitGroup ufs := make([]*upstream.Fs, len(upstreams)) mtimes := make([]time.Time, len(upstreams)) @@ -30,7 +30,7 @@ func (p *Newest) newest(ctx context.Context, upstreams []*upstream.Fs, path stri go func() { defer wg.Done() rfs := u.RootFs - remote := filepath.Join(u.RootPath, path) + remote := path.Join(u.RootPath, filePath) if e := findEntry(ctx, rfs, remote); e != nil { ufs[i] = u mtimes[i] = e.ModTime(ctx) diff --git a/backend/union/policy/policy.go b/backend/union/policy/policy.go index 0f3456374..0cb2d0007 100644 --- a/backend/union/policy/policy.go +++ b/backend/union/policy/policy.go @@ -4,7 +4,6 @@ import ( "context" "math/rand" "path" - "path/filepath" "strings" "time" @@ -95,7 +94,7 @@ func parentDir(absPath string) string { } func clean(absPath string) string { - cleanPath := path.Clean(filepath.ToSlash(absPath)) + cleanPath := path.Clean(absPath) if cleanPath == "." { cleanPath = "" }