1
0
mirror of https://github.com/rclone/rclone.git synced 2025-08-10 06:09:44 +02: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:
nielash
2025-08-09 00:21:19 -04:00
parent 2a587d21c4
commit f7968aad1c

View File

@@ -11,6 +11,7 @@ Make TesTrun have a []string of flags to try - that then makes it generic
*/
import (
"encoding/csv"
"flag"
"fmt"
"math/rand"
@@ -79,7 +80,14 @@ func main() {
// Filter selection
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 != "" {
conf.filterBackendsByBackends(strings.Split(*testBackends, ","))