mirror of
https://github.com/rclone/rclone.git
synced 2025-12-10 05:13:45 +00:00
fstest: fix parsing of commas in -remotes
Connection string remotes like "TestGoogleCloudStorage,directory_markers:" use commas. Before this change, these could not be passed with the -remotes flag, which expected commas to be used only as separators. After this change, CSV parsing is used so that commas will be properly recognized inside a terminal-escaped and quoted value, like: -remotes local,\"TestGoogleCloudStorage,directory_markers:\"
This commit is contained in:
@@ -11,6 +11,7 @@ Make TesTrun have a []string of flags to try - that then makes it generic
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/csv"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@@ -79,7 +80,14 @@ func main() {
|
|||||||
|
|
||||||
// Filter selection
|
// Filter selection
|
||||||
if *testRemotes != "" {
|
if *testRemotes != "" {
|
||||||
conf.filterBackendsByRemotes(strings.Split(*testRemotes, ","))
|
// CSV parse to support connection string remotes with commas like -remotes local,\"TestGoogleCloudStorage,directory_markers:\"
|
||||||
|
r := csv.NewReader(strings.NewReader(*testRemotes))
|
||||||
|
remotes, err := r.Read()
|
||||||
|
if err != nil {
|
||||||
|
fs.Fatalf(*testRemotes, "error CSV-parsing -remotes string: %v", err)
|
||||||
|
}
|
||||||
|
fs.Debugf(*testRemotes, "using remotes: %v", remotes)
|
||||||
|
conf.filterBackendsByRemotes(remotes)
|
||||||
}
|
}
|
||||||
if *testBackends != "" {
|
if *testBackends != "" {
|
||||||
conf.filterBackendsByBackends(strings.Split(*testBackends, ","))
|
conf.filterBackendsByBackends(strings.Split(*testBackends, ","))
|
||||||
|
|||||||
Reference in New Issue
Block a user