Opened 11 years ago
Closed 11 years ago
#11281 closed defect (worksforme)
Possible issue with ListTagged macro and pagination
Reported by: | Ryan J Ollos | Owned by: | Steffen Hoffmann |
---|---|---|---|
Priority: | normal | Component: | TagsPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
I found this in the logs (running r13304 of TagsPlugin),
2013-08-15 08:23:15,582 Trac[formatter] ERROR: Macro ListTagged(theme) failed: Traceback (most recent call last): File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 765, in _macro_formatter return macro.ensure_inline(macro.process(args)) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 356, in process text = self.processor(text) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 343, in _macro_processor text) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracTags-0.7dev_r13278-py2.6.egg/tractags/macros.py", line 233, in expand_macro results = self._paginate(req, results) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracTags-0.7dev_r13278-py2.6.egg/tractags/macros.py", line 365, in _paginate result = Paginator(results, current_page - 1, items_per_page) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/util/presentation.py", line 205, in __init__ items, num_items, num_pages = paginate(items, page, max_per_page) File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/util/presentation.py", line 176, in paginate assert start < count, 'Page %d out of range' % page AssertionError: Page 1 out of range
I'm not sure what to make of it. Searching for ListTagged(theme)
yields one hit: wiki:dreamkxd. The content on the page looks okay. Just wanted to raise the issue early in case it could point to a potential issue we haven't observed yet.
Attachments (0)
Change History (2)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Tried to reproduce this issue by hand-editing the url request parameter 'listtagged_page' of a page with paged ListTagged
beyond the maximum number of pages.
I could raise the error, but only if the macro yields results. Adding extra URL parameters for a page with non-paging ListTagged
result display:
?listtagged_page=1
does just nothing,?listtagged_page=2
raises the exact error reported here,?listtagged_page=x
with 'x' being any value > 1 in general raises an error with 'Page n' being n a value one less than the page value in the added request parameter (n = x - 1).- for completeness: value of 0 or less (any negative parameter) yields a page with no match displayed for the
ListTagged
macro - without editing wiki markup.
For this last scenario the ListTagged
header (macro with format=table) is fun: x = 0 and 100 results per page makes it read 'Results (-199 - -100 of z)' with z being the actual number of (suppressed) results.
Bottom line: While I could reproduce the issue it was visible only by requesting hand-crafted URLs. No such URL could be found in links generated by the tag system or the pager representation it uses (an imported Trac core component). Unless someone can show malformed code generated by the plugin I assume, the error is raised by tampering with URL for some reason; adventurous users, bots, research for site vulnerability - could be many reasons. I do not care for now, because it looks no longer suspicious after running the aforementioned tests.
On closer look, there are many similar consecutive errors in the logs: