use pathEscape / pathUnescape for query/rx URLs (fixes + in regex)

This commit is contained in:
mappu 2017-12-10 12:48:24 +13:00
parent e0ff64cd22
commit 7b9aece4d2

View File

@ -121,7 +121,7 @@ func (this *ArchiveServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} else if matches := this.rxSearch.FindStringSubmatch(r.URL.Path); len(matches) > 0 {
if ls := this.lookupSource(matches[1]); ls != nil {
arc.selectSource(ls, matches[1])
arc.query, _ = url.QueryUnescape(matches[2])
arc.query, _ = url.PathUnescape(matches[2])
arc.queryIsRegex = false
arc.renderSearch(w)
@ -132,7 +132,7 @@ func (this *ArchiveServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} else if matches := this.rxSearchRx.FindStringSubmatch(r.URL.Path); len(matches) > 0 {
if ls := this.lookupSource(matches[1]); ls != nil {
arc.selectSource(ls, matches[1])
arc.query, _ = url.QueryUnescape(matches[2])
arc.query, _ = url.PathUnescape(matches[2])
arc.queryIsRegex = true
arc.renderSearch(w)