Wait it was just an issue of single quotes versus double quotes, because single quotes are valid in filenames

This commit is contained in:
Seednode 2023-11-07 20:22:14 -06:00
parent 0d43dbeeb1
commit 77e98c1f52
2 changed files with 9 additions and 18 deletions

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
ReleaseVersion string = "3.2.5" ReleaseVersion string = "3.2.6"
) )
var ( var (

View File

@ -6,7 +6,6 @@ package cmd
import ( import (
"fmt" "fmt"
"net/url"
"sort" "sort"
"strings" "strings"
@ -91,14 +90,6 @@ Loop:
return first, last, nil return first, last, nil
} }
func pathUrlEscape(path string) string {
placeholder := strings.Replace(path, "/", "path_placeholder", -1)
escaped := url.QueryEscape(placeholder)
return strings.Replace(escaped, "path_placeholder", "/", -1)
}
func paginateSorted(path, first, last, queryParams string, regexes *regexes, formats types.Types) (string, error) { func paginateSorted(path, first, last, queryParams string, regexes *regexes, formats types.Types) (string, error) {
split, err := split(path, regexes) split, err := split(path, regexes)
if err != nil { if err != nil {
@ -153,31 +144,31 @@ func paginateSorted(path, first, last, queryParams string, regexes *regexes, for
html.WriteString(`<table style="margin-left:auto;margin-right:auto;"><tr><td>`) html.WriteString(`<table style="margin-left:auto;margin-right:auto;"><tr><td>`)
html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = '%s%s%s%s';"%s>First</button>`, html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = "%s%s%s%s";"%s>First</button>`,
Prefix, Prefix,
mediaPrefix, mediaPrefix,
pathUrlEscape(first), first,
queryParams, queryParams,
firstStatus)) firstStatus))
html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = '%s%s%s%s';"%s>Prev</button>`, html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = "%s%s%s%s";"%s>Prev</button>`,
Prefix, Prefix,
mediaPrefix, mediaPrefix,
pathUrlEscape(prevPage), prevPage,
queryParams, queryParams,
prevStatus)) prevStatus))
html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = '%s%s%s%s';"%s>Next</button>`, html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = "%s%s%s%s";"%s>Next</button>`,
Prefix, Prefix,
mediaPrefix, mediaPrefix,
pathUrlEscape(nextPage), nextPage,
queryParams, queryParams,
nextStatus)) nextStatus))
html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = '%s%s%s%s';"%s>Last</button>`, html.WriteString(fmt.Sprintf(`<button onclick="window.location.href = "%s%s%s%s";"%s>Last</button>`,
Prefix, Prefix,
mediaPrefix, mediaPrefix,
pathUrlEscape(last), last,
queryParams, queryParams,
lastStatus)) lastStatus))