forked from TrueCloudLab/rclone
Allow spaces in remotes and check remote names for validity at creation time - fixes #171
This commit is contained in:
parent
6344c3051c
commit
4e952af614
2 changed files with 4 additions and 1 deletions
|
@ -498,11 +498,14 @@ func EditConfig() {
|
||||||
for {
|
for {
|
||||||
fmt.Printf("name> ")
|
fmt.Printf("name> ")
|
||||||
name := ReadLine()
|
name := ReadLine()
|
||||||
|
parts := matcher.FindStringSubmatch(name + ":")
|
||||||
switch {
|
switch {
|
||||||
case name == "":
|
case name == "":
|
||||||
fmt.Printf("Can't use empty name\n")
|
fmt.Printf("Can't use empty name\n")
|
||||||
case isDriveLetter(name):
|
case isDriveLetter(name):
|
||||||
fmt.Printf("Can't use %q as it can be confused a drive letter\n", name)
|
fmt.Printf("Can't use %q as it can be confused a drive letter\n", name)
|
||||||
|
case len(parts) != 3 || parts[2] != "":
|
||||||
|
fmt.Printf("Can't use %q as it has invalid characters in it %v\n", name, parts)
|
||||||
default:
|
default:
|
||||||
NewRemote(name)
|
NewRemote(name)
|
||||||
break nameLoop
|
break nameLoop
|
||||||
|
|
2
fs/fs.go
2
fs/fs.go
|
@ -284,7 +284,7 @@ func Find(name string) (*Info, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pattern to match an rclone url
|
// Pattern to match an rclone url
|
||||||
var matcher = regexp.MustCompile(`^([\w_-]+):(.*)$`)
|
var matcher = regexp.MustCompile(`^([\w_ -]+):(.*)$`)
|
||||||
|
|
||||||
// NewFs makes a new Fs object from the path
|
// NewFs makes a new Fs object from the path
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue