Terrible workaround for not URL-encoding path separators
This commit is contained in:
parent
9953bb50dc
commit
e22c171b29
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ReleaseVersion string = "3.2.3"
|
ReleaseVersion string = "3.2.4"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
16
cmd/sort.go
16
cmd/sort.go
|
@ -91,6 +91,14 @@ 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 {
|
||||||
|
@ -148,28 +156,28 @@ func paginateSorted(path, first, last, queryParams string, regexes *regexes, for
|
||||||
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,
|
||||||
url.QueryEscape(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,
|
||||||
url.QueryEscape(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,
|
||||||
url.QueryEscape(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,
|
||||||
url.QueryEscape(last),
|
pathUrlEscape(last),
|
||||||
queryParams,
|
queryParams,
|
||||||
lastStatus))
|
lastStatus))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue