[rt-users] cannot bookmark searches on relative comparisons?

Jason Taylor jtaylor at bastyr.edu
Wed Dec 10 11:58:22 EST 2003



Tim Pierce wrote:

> On Tue, Dec 09, 2003 at 06:34:30PM -0800, Jason Taylor wrote:
> 
>>>>Tim Pierce wrote:
>>>>
>>>>I am using RT 3.0.2 and am having trouble bookmarking searches that
>>>>involve relative comparisons.  For example:
>>>>
>>>> * I search for tickets where "owner = joe" and "priority < 100"
>>>> * Bookmark this search.
>>>> * Search for tickets where "owner = fred", but don't bookmark it.
>>>> * Open a new browser window.
>>>> * Visit the bookmarked search.
>>
>>My suspicions are still leaning toward a URL length issue.  Maybe 
>>getting truncated in Mason or some other perl module.
> 
> 
> Oops, I fixed this after a couple days of hunting but neglected to
> post the fix back to the list (since no one else seemed to be bothered
> by it :-)
> 
> Unfortunately my development environment is a little squotzed at the
> moment, so I don't have true diffs to give you, but you need to modify
> Search/Listing.html.  There's a line that looks like this:
> 
> <A HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|u%>&TicketsSortBy=<%$session{'tickets_sort_by'}%>&TicketsSortOrder=<%$session{'tickets_sort_order'}%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>"><&|/l&>Bookmarkable URL for this search</&></a>
> 
> "FreezeLimits()|u" should be changed to "FreezeLimits()|u,n":
> 
> <A HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|u,n%>&TicketsSortBy=<%$session{'tickets_sort_by'}%>&TicketsSortOrder=<%$session{'tickets_sort_order'}%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>"><&|/l&>Bookmarkable URL for this search</&></a>
> 
> The reason is that RT is both HTML-escaping and URL-escaping the
> bookmark search parameters when it sends this URL to the browser, but
> it doesn't HTML-unescape the string when the browser sends it back.
> So the server attempts to perform a search on criteria like "priority
> < 100" which of course is not intelligible to SQL.  Since the
> string is already being URL-escaped (with the "|u") flag, we can turn
> off HTML-escaping (which is what adding ",n" means).
> 
> At some point I'll collect my changes and submit a proper diff for
> this fix.
> 
> -- twp

Yes.  That fixed it.  Thank you very much!  Not having to constantly 
recreate queries is going to save me a lot of time.




More information about the rt-users mailing list