URL-encode file paths for first/prev/next/last buttons with sorted files

This commit is contained in:
Seednode 2023-11-07 20:04:48 -06:00
parent 00b8af42fe
commit 9953bb50dc
2 changed files with 6 additions and 5 deletions

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
ReleaseVersion string = "3.2.2" ReleaseVersion string = "3.2.3"
) )
var ( var (

View File

@ -6,6 +6,7 @@ package cmd
import ( import (
"fmt" "fmt"
"net/url"
"sort" "sort"
"strings" "strings"
@ -147,28 +148,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,
first, url.QueryEscape(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, url.QueryEscape(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, url.QueryEscape(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, url.QueryEscape(last),
queryParams, queryParams,
lastStatus)) lastStatus))