diff --git a/main.go b/main.go index 1907290..76b238d 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "log" "net/http" "os" + "regexp" "strconv" "strings" @@ -121,10 +122,11 @@ func generateParamFormat(switchesF []*bool, freeStyleF *string, formatF *string, // If --format is specified, let's return the format the user wants if *formatF != "" { + re := regexp.MustCompile("\\s") var str strings.Builder - str.WriteString("?format=\"") - str.WriteString(*formatF) - str.WriteString("\"") + + str.WriteString("?format=") + str.WriteString(re.ReplaceAllString(*formatF, "%20")) return str.String(), downloadMode, nil } // If --one-liner is specified, we know the format is set so let's return it