@@ -20,6 +20,7 @@ import (
2020 "github.com/rclone/rclone/fs/config/obscure"
2121 "github.com/rclone/rclone/fs/hash"
2222 "github.com/rclone/rclone/lib/dircache"
23+ "github.com/rclone/rclone/lib/encoder"
2324)
2425
2526// Register with Fs
@@ -64,6 +65,7 @@ type Fs struct {
6465 rootIsFile bool
6566 rootFile * folders.File
6667 features * fs.Features
68+ encoding encoder.MultiEncoder
6769}
6870
6971// Object holds the data for a remote file object
@@ -132,6 +134,8 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
132134 CanHaveEmptyDirectories : false ,
133135 })
134136
137+ f .encoding = encoder .EncodeBackSlash
138+
135139 f .dirCache = dircache .New ("" , cfg .RootFolderID , f )
136140
137141 if root != "" {
@@ -171,9 +175,6 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
171175
172176// Mkdir creates a new directory
173177func (f * Fs ) Mkdir (ctx context.Context , dir string ) error {
174- if hasPunctuationChars (dir ) {
175- return fs .ErrorNotImplemented
176- }
177178 _ , err := f .dirCache .FindDir (ctx , dir , true )
178179 if err != nil && strings .Contains (err .Error (), `"statusCode":400` ) {
179180 return nil
@@ -270,10 +271,6 @@ func (f *Fs) List(ctx context.Context, dir string) (fs.DirEntries, error) {
270271func (f * Fs ) Put (ctx context.Context , in io.Reader , src fs.ObjectInfo , options ... fs.OpenOption ) (fs.Object , error ) {
271272 remote := src .Remote ()
272273
273- if hasPunctuationChars (remote ) {
274- return nil , fs .ErrorNotImplemented
275- }
276-
277274 parentDir , fileName := path .Split (remote )
278275 parentDir = strings .Trim (parentDir , "/" )
279276
@@ -339,10 +336,6 @@ func (f *Fs) DirCacheFlush(ctx context.Context) {}
339336
340337// NewObject creates a new object
341338func (f * Fs ) NewObject (ctx context.Context , remote string ) (fs.Object , error ) {
342- if hasPunctuationChars (remote ) {
343- return nil , fs .ErrorNotImplemented
344- }
345-
346339 if f .rootIsFile {
347340 leaf := path .Base (f .root )
348341 if remote == "" || remote == leaf {
@@ -469,14 +462,3 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
469462func (o * Object ) Remove (ctx context.Context ) error {
470463 return files .DeleteFile (o .f .cfg , o .uuid )
471464}
472-
473- func hasPunctuationChars (s string ) bool {
474- /*
475- const disallowed = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
476- for _, r := range s {
477- if strings.ContainsRune(disallowed, r) {
478- return true
479- }
480- }*/
481- return false
482- }
0 commit comments