mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
fspath: Stop empty strings being a valid path - fixes #4239
Before this change you could use "" as a valid remote, so `rclone lsf ""` would work. This was treated as the current directory. This is unexpected and creates a footgun for scripting when an empty variable is passed to rclone by accident. This fix returns the error "can't use empty string as a path" instead of allowing it.
This commit is contained in:
@@ -55,7 +55,7 @@ func TestParse(t *testing.T) {
|
||||
in, wantConfigName, wantFsPath string
|
||||
wantErr error
|
||||
}{
|
||||
{"", "", "", nil},
|
||||
{"", "", "", errCantBeEmpty},
|
||||
{":", "", "", errInvalidCharacters},
|
||||
{"::", ":", "", errInvalidCharacters},
|
||||
{":/:", "", "/:", errInvalidCharacters},
|
||||
@@ -91,7 +91,7 @@ func TestSplit(t *testing.T) {
|
||||
remote, wantParent, wantLeaf string
|
||||
wantErr error
|
||||
}{
|
||||
{"", "", "", nil},
|
||||
{"", "", "", errCantBeEmpty},
|
||||
|
||||
{"remote:", "remote:", "", nil},
|
||||
{"remote:potato", "remote:", "potato", nil},
|
||||
|
||||
Reference in New Issue
Block a user