"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
rest: rename URLEscape to URLPathEscape for consistency with go1.8
Nick Craig-Woodbe4ed145252c
diff --git a/http/http.go b/http/http.goindex c26f616e9..3cf590125 100644--- a/http/http.go+++ b/http/http.go@@ -89,7 +89,7 @@ func NewFs(name, root string) (fs.Fs, error) {if err != nil {return nil, err}- u, err := rest.URLJoin(base, rest.URLEscape(root))+ u, err := rest.URLJoin(base, rest.URLPathEscape(root))if err != nil {return nil, err}@@ -186,7 +186,7 @@ func (f *Fs) NewObject(remote string) (fs.Object, error) {// Join's the remote onto the base URLfunc (f *Fs) url(remote string) string {- return f.endpointURL + rest.URLEscape(remote)+ return f.endpointURL + rest.URLPathEscape(remote)}func parseInt64(s string) int64 {diff --git a/http/http_internal_test.go b/http/http_internal_test.goindex 2555f6c21..80b28d5d3 100644--- a/http/http_internal_test.go+++ b/http/http_internal_test.go@@ -223,7 +223,7 @@ func TestParseName(t *testing.T) {{"http://example.com/dir/", "subdir/potato", false, ""},{"http://example.com/dir/", "With percent %25.txt", true, "With percent %.txt"},{"http://example.com/dir/", "With colon :", false, ""},- {"http://example.com/dir/", rest.URLEscape("With colon :"), true, "With colon :"},+ {"http://example.com/dir/", rest.URLPathEscape("With colon :"), true, "With colon :"},} {u, err := url.Parse(test.base)require.NoError(t, err)diff --git a/onedrive/onedrive.go b/onedrive/onedrive.goindex d9d613490..310d547db 100644--- a/onedrive/onedrive.go+++ b/onedrive/onedrive.go@@ -308,7 +308,7 @@ func shouldRetry(resp *http.Response, err error) (bool, error) {func (f *Fs) readMetaDataForPath(path string) (info *api.Item, resp *http.Response, err error) {opts := rest.Opts{Method: "GET",- Path: "/root:/" + rest.URLEscape(replaceReservedChars(path)),+ Path: "/root:/" + rest.URLPathEscape(replaceReservedChars(path)),}err = f.pacer.Call(func() (bool, error) {resp, err = f.srv.CallJSON(&opts, nil, &info)@@ -1024,7 +1024,7 @@ func (o *Object) ModTime() time.Time {func (o *Object) setModTime(modTime time.Time) (*api.Item, error) {opts := rest.Opts{Method: "PATCH",- Path: "/root:/" + rest.URLEscape(o.srvPath()),+ Path: "/root:/" + rest.URLPathEscape(o.srvPath()),}update := api.SetFileSystemInfo{FileSystemInfo: api.FileSystemInfoFacet{@@ -1079,7 +1079,7 @@ func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) {func (o *Object) createUploadSession() (response *api.CreateUploadResponse, err error) {opts := rest.Opts{Method: "POST",- Path: "/root:/" + rest.URLEscape(o.srvPath()) + ":/upload.createSession",+ Path: "/root:/" + rest.URLPathEscape(o.srvPath()) + ":/upload.createSession",}var resp *http.Responseerr = o.fs.pacer.Call(func() (bool, error) {@@ -1185,7 +1185,7 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptiovar resp *http.Responseopts := rest.Opts{Method: "PUT",- Path: "/root:/" + rest.URLEscape(o.srvPath()) + ":/content",+ Path: "/root:/" + rest.URLPathEscape(o.srvPath()) + ":/content",ContentLength: &size,Body: in,}diff --git a/rest/url.go b/rest/url.goindex 14eeac4a1..07ce15958 100644--- a/rest/url.go+++ b/rest/url.go@@ -17,10 +17,10 @@ func URLJoin(base *url.URL, path string) (*url.URL, error) {return base.ResolveReference(rel), nil}-// URLEscape escapes URL path the in string using URL escaping rules+// URLPathEscape escapes URL path the in string using URL escaping rules//// This mimics url.PathEscape which only available from go 1.8-func URLEscape(in string) string {+func URLPathEscape(in string) string {var u url.URLu.Path = inreturn u.String()diff --git a/rest/url_test.go b/rest/url_test.goindex 1b7704a9d..7a7e51bdf 100644--- a/rest/url_test.go+++ b/rest/url_test.go@@ -30,7 +30,7 @@ func TestURLJoin(t *testing.T) {{"http://example.com/dir/", "subdir/potato", true, "http://example.com/dir/subdir/potato"},{"http://example.com/dir/", "With percent %25.txt", true, "http://example.com/dir/With%20percent%20%25.txt"},{"http://example.com/dir/", "With colon :", false, ""},- {"http://example.com/dir/", URLEscape("With colon :"), true, "http://example.com/dir/With%20colon%20:"},+ {"http://example.com/dir/", URLPathEscape("With colon :"), true, "http://example.com/dir/With%20colon%20:"},} {u, err := url.Parse(test.base)require.NoError(t, err)@@ -46,7 +46,7 @@ func TestURLJoin(t *testing.T) {}}-func TestURLEscape(t *testing.T) {+func TestURLPathEscape(t *testing.T) {for i, test := range []struct {path stringwant string@@ -57,7 +57,7 @@ func TestURLEscape(t *testing.T) {{"With Colon:", "./With%20Colon:"},{"With Percent%", "With%20Percent%25"},} {- got := URLEscape(test.path)+ got := URLPathEscape(test.path)assert.Equal(t, test.want, got, fmt.Sprintf("Test %d path = %q", i, test.path))}}diff --git a/s3/s3.go b/s3/s3.goindex b95193b28..96e15ebb3 100644--- a/s3/s3.go+++ b/s3/s3.go@@ -786,7 +786,7 @@ func (f *Fs) Copy(src fs.Object, remote string) (fs.Object, error) {}srcFs := srcObj.fskey := f.root + remote- source := rest.URLEscape(srcFs.bucket + "/" + srcFs.root + srcObj.remote)+ source := rest.URLPathEscape(srcFs.bucket + "/" + srcFs.root + srcObj.remote)req := s3.CopyObjectInput{Bucket: &f.bucket,Key: &key,@@ -935,7 +935,7 @@ func (o *Object) SetModTime(modTime time.Time) error {ACL: &o.fs.acl,Key: &key,ContentType: &mimeType,- CopySource: aws.String(rest.URLEscape(sourceKey)),+ CopySource: aws.String(rest.URLPathEscape(sourceKey)),Metadata: o.meta,MetadataDirective: &directive,}diff --git a/webdav/webdav.go b/webdav/webdav.goindex 91602ac7b..6dde3b560 100644--- a/webdav/webdav.go+++ b/webdav/webdav.go@@ -232,7 +232,7 @@ func addSlash(s string) string {// filePath returns a file path (f.root, file)func (f *Fs) filePath(file string) string {- return rest.URLEscape(path.Join(f.root, file))+ return rest.URLPathEscape(path.Join(f.root, file))}// dirPath returns a directory path (f.root, dir)