From 9eeed2541850049931a9ae396a9d6e96d447bfc3 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 15 Jul 2016 14:18:09 +0100 Subject: [PATCH] local: fix filenames with invalid UTF-8 not being uploaded #568 --- local/local.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/local/local.go b/local/local.go index 405cb51ac..7f08ecf42 100644 --- a/local/local.go +++ b/local/local.go @@ -52,8 +52,8 @@ type Fs struct { // Object represents a local filesystem object type Object struct { fs *Fs // The Fs this object is part of - remote string // The remote path - path string // The local path + remote string // The remote path - properly UTF-8 encoded - for rclone + path string // The local path - may not be properly UTF-8 encoded - for OS info os.FileInfo // Interface for file info (always present) hashes map[fs.HashType]string // Hashes } @@ -70,7 +70,7 @@ func NewFs(name, root string) (fs.Fs, error) { warned: make(map[string]struct{}), nounc: nounc == "true", } - f.root = f.filterPath(f.cleanUtf8(root)) + f.root = f.filterPath(root) // Check to see if this points to a file fi, err := os.Lstat(f.root) @@ -101,8 +101,8 @@ func (f *Fs) String() string { // newObject makes a half completed Object func (f *Fs) newObject(remote string) *Object { remote = normString(remote) - remote = filepath.ToSlash(remote) - dstPath := f.filterPath(filepath.Join(f.root, f.cleanUtf8(remote))) + dstPath := f.filterPath(filepath.Join(f.root, remote)) + remote = filepath.ToSlash(f.cleanUtf8(remote)) return &Object{ fs: f, remote: remote, @@ -479,7 +479,7 @@ func (o *Object) String() string { // Remote returns the remote path func (o *Object) Remote() string { - return o.fs.cleanUtf8(o.remote) + return o.remote } // Hash returns the requested hash of a file as a lowercase hex string