Wait no actually single quotes specifically do need to be escaped

This commit is contained in:
Seednode 2023-11-07 20:32:20 -06:00
parent be2c118284
commit 0c45103fbd
2 changed files with 13 additions and 9 deletions

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
ReleaseVersion string = "3.2.7" ReleaseVersion string = "3.2.8"
) )
var ( var (

View File

@ -90,6 +90,10 @@ Loop:
return first, last, nil return first, last, nil
} }
func pathUrlEscape(path string) string {
return strings.Replace(path, `'`, `'`, -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 {
@ -144,31 +148,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,
first, pathUrlEscape(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,
prevPage, pathUrlEscape(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,
nextPage, pathUrlEscape(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,
last, pathUrlEscape(last),
queryParams, queryParams,
lastStatus)) lastStatus))