[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
This commit is contained in:
parent
52f25ed46d
commit
34fd79b312
1 changed files with 5 additions and 3 deletions
8
main.go
8
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
|
||||
|
|
Loading…
Reference in a new issue