mirror of
https://github.com/rclone/rclone.git
synced 2025-08-22 11:01:06 +02:00
config: check config names more carefully and report errors - fixes #3506
Before this change it was possible to make a remote with an invalid name in the config file, either manually or with `rclone config create` (but not with `rclone config`). When this remote was used, because it was invalid, rclone would presume this remote name was a local directory for a very suprising user experience! This change checks remote names more carefully and returns errors - when the user tries to use an invalid remote name on the command line - when an invalid remote name is used in `rclone config create/update/password` - when the user tries to enter an invalid remote name in `rclone config` This does not prevent the user entering a remote name with invalid characters in the config manually, but such a remote will fail immediately when it is used on the command line.
This commit is contained in:
5
fs/fs.go
5
fs/fs.go
@@ -1087,7 +1087,10 @@ func MustFind(name string) *RegInfo {
|
||||
// ParseRemote deconstructs a path into configName, fsPath, looking up
|
||||
// the fsName in the config file (returning NotFoundInConfigFile if not found)
|
||||
func ParseRemote(path string) (fsInfo *RegInfo, configName, fsPath string, err error) {
|
||||
configName, fsPath = fspath.Parse(path)
|
||||
configName, fsPath, err = fspath.Parse(path)
|
||||
if err != nil {
|
||||
return nil, "", "", err
|
||||
}
|
||||
var fsName string
|
||||
var ok bool
|
||||
if configName != "" {
|
||||
|
Reference in New Issue
Block a user