Fix git graph page (#34948) (#34949)
Some checks failed
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-docker-rootful (push) Has been cancelled
release-nightly / nightly-docker-rootless (push) Has been cancelled

This commit is contained in:
wxiaoguang
2025-07-04 23:33:17 +08:00
committed by GitHub
parent 9adf175df0
commit 4aba42519d
4 changed files with 19 additions and 7 deletions

View File

@ -33,8 +33,8 @@ func (p *Pagination) WithCurRows(n int) *Pagination {
return p
}
func (p *Pagination) AddParamFromRequest(req *http.Request) {
for key, values := range req.URL.Query() {
func (p *Pagination) AddParamFromQuery(q url.Values) {
for key, values := range q {
if key == "page" || len(values) == 0 || (len(values) == 1 && values[0] == "") {
continue
}
@ -45,6 +45,10 @@ func (p *Pagination) AddParamFromRequest(req *http.Request) {
}
}
func (p *Pagination) AddParamFromRequest(req *http.Request) {
p.AddParamFromQuery(req.URL.Query())
}
// GetParams returns the configured URL params
func (p *Pagination) GetParams() template.URL {
return template.URL(strings.Join(p.urlParams, "&"))