If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Search result page redirects to addon page incorrectly



addons.mozilla.org Graveyard
Public Pages
12 years ago
2 years ago


(Reporter: Cameron, Assigned: justdave)





(1 attachment)



12 years ago
If you search and find 10x+1 addons (ie. 11, 21, 31 etc,) the "next page" link on the second to last page will take you directly to the last addon's listing page, rather than to a search page showing the final item.

This is because if you search and only find one addon, it automatically redirects you to that addon.

Of course if you manually select a different number of addons per page, then this bug will occur with other numbers of addons in the results.

To reproduce:
1) Go to https://addons.mozilla.org/search.php?app=firefox&q=rss&perpage=10&left=20 - as of when this bug was filed, there are 31 results. This will of course change in future.
2) Click "next page" 
3) Be redirected to one addon's page

Expected results: Show a search page with only one item on it, including a "previous page" link.
Created attachment 221253 [details] [diff] [review]
Patch v1

This is completely untested, but looks like the right thing to do...
Assignee: nobody → justdave
Attachment #221253 - Flags: first-review?(morgamic)
Comment on attachment 221253 [details] [diff] [review]
Patch v1

Should be:
// If we have only one result, redirect to the addon page.
if ( $resultCount == 1) {

It was pointing to the wrong count (and an expensive one at that!).  The $resultCount variable holds the number returned by "SELECT FOUND_ROWS()" which gives us the overall # of records (not just the # of list items in the actual result set to be used for the template).
Attachment #221253 - Flags: first-review?(morgamic) → first-review-
Tested this fix, committing shortly.
Last Resolved: 12 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.