mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +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
|
||||
|
||||
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 end with space.
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ func TestNewRemoteName(t *testing.T) {
|
|||
config.ReadLine = makeReadLine([]string{
|
||||
"test", // already exists
|
||||
"", // empty string not allowed
|
||||
"bad@characters", // bad characters
|
||||
"bad^characters", // bad characters
|
||||
"newname", // OK
|
||||
})
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@ import (
|
|||
)
|
||||
|
||||
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
|
||||
illegalPartOfConfigNameRe = `^[ -]+|[^\w\p{L}\p{N}. -]+|[ ]+$`
|
||||
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}.+@ -]+|[ ]+$`
|
||||
)
|
||||
|
||||
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")
|
||||
errBadConfigParam = errors.New("config parameters may only contain `0-9`, `A-Z`, `a-z` and `_`")
|
||||
errEmptyConfigParam = errors.New("config parameters can't be empty")
|
||||
|
|
|
@ -41,6 +41,8 @@ func TestCheckConfigName(t *testing.T) {
|
|||
{"..", nil, ".."},
|
||||
{".r.e.m.o.t.e.", nil, ".r.e.m.o.t.e."},
|
||||
{"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"},
|
||||
{"chữ Quốc ngữ", nil, "chữ Quốc ngữ"},
|
||||
{"remote ", errInvalidCharacters, "remote_"},
|
||||
|
@ -68,6 +70,8 @@ func TestCheckRemoteName(t *testing.T) {
|
|||
{".r.e.m.o.t.e.:", nil},
|
||||
{"-r-emote-:", errInvalidCharacters},
|
||||
{"rem ote:", nil},
|
||||
{"user@example.com:", nil},
|
||||
{"user+junkmail@example.com:", nil},
|
||||
{"blåbær:", nil},
|
||||
{"chữ Quốc ngữ:", nil},
|
||||
{"remote :", errInvalidCharacters},
|
||||
|
|
Loading…
Reference in New Issue
Block a user