mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 12:36:38 +08:00
fspath: allow the symbols at and plus in remote names - fixes #6710
This commit is contained in:
parent
8c8ee9905c
commit
c5acb10151
|
@ -338,7 +338,7 @@ Will get their own names
|
||||||
### Valid remote names
|
### Valid remote names
|
||||||
|
|
||||||
Remote names are case sensitive, and must adhere to the following rules:
|
Remote names are case sensitive, and must adhere to the following rules:
|
||||||
- May contain number, letter, `_`, `-`, `.` and space.
|
- May contain number, letter, `_`, `-`, `.`, `+`, `@` and space.
|
||||||
- May not start with `-` or space.
|
- May not start with `-` or space.
|
||||||
- May not end with space.
|
- May not end with space.
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ func TestNewRemoteName(t *testing.T) {
|
||||||
config.ReadLine = makeReadLine([]string{
|
config.ReadLine = makeReadLine([]string{
|
||||||
"test", // already exists
|
"test", // already exists
|
||||||
"", // empty string not allowed
|
"", // empty string not allowed
|
||||||
"bad@characters", // bad characters
|
"bad^characters", // bad characters
|
||||||
"newname", // OK
|
"newname", // OK
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
configNameRe = `[\w\p{L}\p{N}.]+(?:[ -]+[\w\p{L}\p{N}.-]+)*` // May contain Unicode numbers and letters, as well as `_`, `-`, `.` and space, but not start with `-` (it complicates usage, see #4261) or space, and not end with space
|
configNameRe = `[\w\p{L}\p{N}.+@]+(?:[ -]+[\w\p{L}\p{N}.+@-]+)*` // May contain Unicode numbers and letters, as well as `_` (covered by \w), `-`, `.`, `+`, `@` and space, but not start with `-` (it complicates usage, see #4261) or space, and not end with space
|
||||||
illegalPartOfConfigNameRe = `^[ -]+|[^\w\p{L}\p{N}. -]+|[ ]+$`
|
illegalPartOfConfigNameRe = `^[ -]+|[^\w\p{L}\p{N}.+@ -]+|[ ]+$`
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
errInvalidCharacters = errors.New("config name contains invalid characters - may only contain numbers, letters, `_`, `-`, `.` and space, while not start with `-` or space, and not end with space")
|
errInvalidCharacters = errors.New("config name contains invalid characters - may only contain numbers, letters, `_`, `-`, `.`, `+`, `@` and space, while not start with `-` or space, and not end with space")
|
||||||
errCantBeEmpty = errors.New("can't use empty string as a path")
|
errCantBeEmpty = errors.New("can't use empty string as a path")
|
||||||
errBadConfigParam = errors.New("config parameters may only contain `0-9`, `A-Z`, `a-z` and `_`")
|
errBadConfigParam = errors.New("config parameters may only contain `0-9`, `A-Z`, `a-z` and `_`")
|
||||||
errEmptyConfigParam = errors.New("config parameters can't be empty")
|
errEmptyConfigParam = errors.New("config parameters can't be empty")
|
||||||
|
|
|
@ -41,6 +41,8 @@ func TestCheckConfigName(t *testing.T) {
|
||||||
{"..", nil, ".."},
|
{"..", nil, ".."},
|
||||||
{".r.e.m.o.t.e.", nil, ".r.e.m.o.t.e."},
|
{".r.e.m.o.t.e.", nil, ".r.e.m.o.t.e."},
|
||||||
{"rem ote", nil, "rem ote"},
|
{"rem ote", nil, "rem ote"},
|
||||||
|
{"user@example.com", nil, "user@example.com"},
|
||||||
|
{"user+junkmail@example.com", nil, "user+junkmail@example.com"},
|
||||||
{"blåbær", nil, "blåbær"},
|
{"blåbær", nil, "blåbær"},
|
||||||
{"chữ Quốc ngữ", nil, "chữ Quốc ngữ"},
|
{"chữ Quốc ngữ", nil, "chữ Quốc ngữ"},
|
||||||
{"remote ", errInvalidCharacters, "remote_"},
|
{"remote ", errInvalidCharacters, "remote_"},
|
||||||
|
@ -68,6 +70,8 @@ func TestCheckRemoteName(t *testing.T) {
|
||||||
{".r.e.m.o.t.e.:", nil},
|
{".r.e.m.o.t.e.:", nil},
|
||||||
{"-r-emote-:", errInvalidCharacters},
|
{"-r-emote-:", errInvalidCharacters},
|
||||||
{"rem ote:", nil},
|
{"rem ote:", nil},
|
||||||
|
{"user@example.com:", nil},
|
||||||
|
{"user+junkmail@example.com:", nil},
|
||||||
{"blåbær:", nil},
|
{"blåbær:", nil},
|
||||||
{"chữ Quốc ngữ:", nil},
|
{"chữ Quốc ngữ:", nil},
|
||||||
{"remote :", errInvalidCharacters},
|
{"remote :", errInvalidCharacters},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user