You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the workflow is dependent on a query being present in the query params. If we search for something on a specific inventoryID and we get 0 results it should show the first page.
If we get zero results because the inventoryID is invalid then we should not have a 'q' in the query params. If we do, we terminate with a 404.
A solution could be:
ifpaging.HitsTotalCount==0&&searchRequest.Tree.IsSearch&&searchRequest.Tree.IsPaging {
// if there is no query in the params then this is already a redirectif!r.URL.Query().Has("q") {
http.Error(w, fmt.Sprintf("inventoryID '%s' not found", searchRequest.Tree.UnitID), http.StatusNotFound)
return
}
newPath:=fmt.Sprintf("%s?paging=true&page=1", r.URL.Path)
http.Redirect(w, r, newPath, http.StatusSeeOther)
return
}
Querying
/api/tree/<spec>/<invalid inventoryID>?paging=true
causes a HTTP 303 response which redirects to the same url.Proposed fix:
Add
&& searchRequest.Tree.Page[0] != 1
to hub3/hub3/server/http/handlers/search.go line 419This way the redirect does not happen if the page already is page 1.
The text was updated successfully, but these errors were encountered: