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 (
ReleaseVersion string = "3.2.5"
ReleaseVersion string = "3.2.6"
)
var (

View File

@ -6,7 +6,6 @@ package cmd
import (
"fmt"
"net/url"
"sort"
"strings"
@ -91,14 +90,6 @@ Loop:
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) {
split, err := split(path, regexes)
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(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,
mediaPrefix,
pathUrlEscape(first),
first,
queryParams,
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,
mediaPrefix,
pathUrlEscape(prevPage),
prevPage,
queryParams,
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,
mediaPrefix,
pathUrlEscape(nextPage),
nextPage,
queryParams,
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,
mediaPrefix,
pathUrlEscape(last),
last,
queryParams,
lastStatus))