diff --git a/backend/drive/drive.go b/backend/drive/drive.go index cca4245c3..93fab7f8d 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -3431,7 +3431,7 @@ func (f *Fs) Command(ctx context.Context, name string, arg []string, opt map[str if err != nil { return nil, err } - re := regexp.MustCompile(`[^\w_. -]+`) + re := regexp.MustCompile(`[^\w\p{L}\p{N}. -]+`) if _, ok := opt["config"]; ok { lines := []string{} upstreams := []string{} diff --git a/docs/content/docs.md b/docs/content/docs.md index d984970b5..eab4b5b29 100644 --- a/docs/content/docs.md +++ b/docs/content/docs.md @@ -338,10 +338,18 @@ Will get their own names ### Valid remote names Remote names are case sensitive, and must adhere to the following rules: - - May only contain `0`-`9`, `A`-`Z`, `a`-`z`, `_`, `-`, `.` and space. + - May contain number, letter, `_`, `-`, `.` and space. - May not start with `-` or space. - May not end with space. +Starting with rclone version 1.61, any Unicode numbers and letters are allowed, +while in older versions it was limited to plain ASCII (0-9, A-Z, a-z). If you use +the same rclone configuration from different shells, which may be configured with +different character encoding, you must be cautious to use characters that are +possible to write in all of them. This is mostly a problem on Windows, where +the console traditionally uses a non-Unicode character set - defined +by the so-called "code page". + Quoting and the shell --------------------- diff --git a/fs/fspath/path.go b/fs/fspath/path.go index a29b0e363..a9dd858d1 100644 --- a/fs/fspath/path.go +++ b/fs/fspath/path.go @@ -13,11 +13,11 @@ import ( ) const ( - configNameRe = `[\w.-]+(?: +[\w.-]+)*` + configNameRe = `[\w\p{L}\p{N}.-]+(?: +[\w\p{L}\p{N}.-]+)*` ) var ( - errInvalidCharacters = errors.New("config name contains invalid characters - may only contain `0-9`, `A-Z`, `a-z`, `_`, `-`, `.` and space, while not start or end with space") + errInvalidCharacters = errors.New("config name contains invalid characters - may only contain numbers, letters, `_`, `-`, `.` and space, while not start or end with space") errCantBeEmpty = errors.New("can't use empty string as a path") errCantStartWithDash = errors.New("config name starts with `-`") errBadConfigParam = errors.New("config parameters may only contain `0-9`, `A-Z`, `a-z` and `_`") diff --git a/fs/fspath/path_test.go b/fs/fspath/path_test.go index 9d80ec4a8..6c4ac754d 100644 --- a/fs/fspath/path_test.go +++ b/fs/fspath/path_test.go @@ -23,6 +23,7 @@ func TestCheckConfigName(t *testing.T) { want error }{ {"remote", nil}, + {"REMOTE", nil}, {"", errInvalidCharacters}, {":remote:", errInvalidCharacters}, {"remote:", errInvalidCharacters}, @@ -38,6 +39,8 @@ func TestCheckConfigName(t *testing.T) { {"..", nil}, {".r.e.m.o.t.e.", nil}, {"rem ote", nil}, + {"blåbær", nil}, + {"chữ Quốc ngữ", nil}, {"remote ", errInvalidCharacters}, {" remote", errInvalidCharacters}, {" remote ", errInvalidCharacters}, @@ -53,6 +56,7 @@ func TestCheckRemoteName(t *testing.T) { want error }{ {":remote:", nil}, + {":REMOTE:", nil}, {":s3:", nil}, {"remote:", nil}, {".:", nil}, @@ -60,6 +64,8 @@ func TestCheckRemoteName(t *testing.T) { {".r.e.m.o.t.e.:", nil}, {"-r-emote-:", nil}, {"rem ote:", nil}, + {"blåbær:", nil}, + {"chữ Quốc ngữ:", nil}, {"remote :", errInvalidCharacters}, {" remote:", errInvalidCharacters}, {" remote :", errInvalidCharacters},