1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-30 07:03:38 +00:00

cache: fix Windows separator issue for #1904 (#1930)

This commit is contained in:
remusb
2017-12-20 17:24:50 +02:00
committed by GitHub
parent 4ba58884b1
commit 0d4bff8239
2 changed files with 8 additions and 7 deletions

7
cache/object.go vendored
View File

@@ -7,7 +7,6 @@ import (
"io"
"os"
"path"
"strings"
"sync"
"time"
@@ -133,8 +132,10 @@ func (o *Object) String() string {
func (o *Object) Remote() string {
p := path.Join(o.Dir, o.Name)
if o.CacheFs.Root() != "" {
p = strings.Replace(p, o.CacheFs.Root(), "", 1)
p = strings.TrimPrefix(p, string(os.PathSeparator))
p = p[len(o.CacheFs.Root()):] // trim out root
if len(p) > 0 { // remove first separator
p = p[1:]
}
}
return p