From 34fd79b312278326435d29e56383730f95a1cb69 Mon Sep 17 00:00:00 2001 From: Elia el Lazkani Date: Sun, 1 Mar 2020 11:07:18 +0100 Subject: [PATCH] [BUGFIX] Removing extra quotation added on --format * Turns out the quotation is a part of "?format=" so it got removed * Added a nice bonus of replacing spaces in --format with their proper URL value --- main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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