M core/routes.go => core/routes.go +2 -1
@@ 4,6 4,7 @@ import (
"database/sql"
"errors"
"fmt"
+ "html/template"
"links"
"links/analytics"
"links/domain"
@@ 1443,7 1444,7 @@ func (s *Service) OrgLinksList(c echo.Context) error {
"hasStarredFilter": hasStarredFilter,
"hasAllFilter": hasAllFilter,
"currURL": currURL,
- "queries": queries,
+ "queries": template.URL(queries.Encode()),
}
if search != "" {
M helpers.go => helpers.go +8 -4
@@ 757,15 757,19 @@ func (t TagQuery) GetSubQuery(inputTag, inputExcludeTag *string) (string, []inte
return subQ.ToSql()
}
-func AddQueryElement(q url.Values, param, val string) template.URL {
- curVal := q.Get(param)
+func AddQueryElement(q template.URL, param, val string) template.URL {
+ query, err := url.ParseQuery(string(q))
+ if err != nil {
+ return ""
+ }
+ curVal := query.Get(param)
if curVal == "" {
curVal = val
} else {
curVal += fmt.Sprintf(",%s", val)
}
- q.Set(param, curVal)
- return template.URL(q.Encode())
+ query.Set(param, curVal)
+ return template.URL(query.Encode())
}
// GetLinksDomain will simply return the config value for `links:links-service-domain`
M list/routes.go => list/routes.go +1 -1
@@ 1068,7 1068,7 @@ func (s *Service) ListingList(c echo.Context) error {
"tagFilter": strings.Replace(tag, ",", ", ", -1),
"excludeTagFilter": strings.Replace(excludeTag, ",", ", ", -1),
"advancedSearch": true,
- "queries": queries,
+ "queries": template.URL(queries.Encode()),
}
if result.Listings.PageInfo.HasPrevPage {
gmap["prevURL"] = links.GetPaginationParams("prev", tag, "", result.Listings.PageInfo.Cursor)
M short/routes.go => short/routes.go +2 -1
@@ 3,6 3,7 @@ package short
import (
"errors"
"fmt"
+ "html/template"
"links"
"links/analytics"
"links/domain"
@@ 175,7 176,7 @@ func (s *Service) LinkShortList(c echo.Context) error {
"tagFilter": strings.Replace(tag, ",", ", ", -1),
"excludeTagFilter": strings.Replace(excludeTag, ",", ", ", -1),
"advancedSearch": true,
- "queries": queries,
+ "queries": template.URL(queries.Encode()),
}
if result.LinkShorts.PageInfo.HasPrevPage {