Edgewall Software
Modify

Opened 15 years ago

Closed 11 years ago

Last modified 11 years ago

#8561 closed defect (fixed)

URL hex encoding in Query.to_string()

Reported by: ebray Owned by: ebray
Priority: normal Milestone: 0.12
Component: ticket system Version: devel
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When I save a custom query containing a filter such as "summary=~foo", it's displayed in the save report page as "summary=%7Efoo". I know that this is due to Query.to_string() just being a thin wrapper around Query.get_href(). But I thought that at least this was fixed a long time ago. Is this a regression, or was it never fixed?

I simply modified my to_string to wrap the call to self.get_href() in unicode_unquote(). That solves the problem nicely, and doesn't seem to have any adverse effects.

You'd think there'd be a ticket addressing this somewhere, but I couldn't find one.

Attachments (0)

Change History (10)

comment:1 by Remy Blank, 15 years ago

Milestone: 0.12
Owner: set to Remy Blank

I'll check that. Thanks for reporting the issue.

comment:2 by ebray, 15 years ago

Yeah, I actually fixed this several months ago in my branch of Trac:

  • trac/trac/ticket/query.py

    a b  
    3535from trac.util.datefmt import to_timestamp, utc
    3636from trac.util.presentation import Paginator
    37 from trac.util.text import shorten_line
     37from trac.util.text import shorten_line, unicode_unquote
    3838from trac.util.translation import _
    3939from trac.web import parse_query_string, IRequestHandler
     
    376376        expressed in TracQuery language.
    377377        """
    378         query_string = self.get_href(Href(''))
     378        query_string = unicode_unquote(self.get_href(Href('')))
    379379        if query_string and '?' in query_string:
    380380            query_string = query_string.split('?', 1)[1]

comment:3 by Remy Blank, 15 years ago

Resolution: fixed
Status: newclosed

No side-effects here either, so I guess it's ok. Patch committed in [8465]. Strangely, except for the cosmetic factor, it was also working correctly before. Does this mean that the following URLs are actually equivalent?

http://example.com/trac?summary=~foo
http://example.com/trac?summary=%7Efoo

Too tired to read RFCs…

comment:4 by Remy Blank, 15 years ago

Owner: changed from Remy Blank to ebray

comment:5 by anonymous, 15 years ago

There is another query.get_href at line 822 and it breaks *some* queries in *some* browsers. Changing

req.redirect(query.get_href(req.href))

to

req.redirect(unicode_unquote(query.get_href(req.href)))

seems to fix it.

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:6 by Christian Boos, 15 years ago

Care to give *some* example that we could integrate in a test?

comment:7 by Remy Blank, 14 years ago

This change caused #9965, so I will revert it, while still trying to keep the query readable.

comment:8 by spamgy@…, 11 years ago

Resolution: fixed
Status: closedreopened

Help… I've 1.0.1 version as different projects. When I put latin letters into summary field all is o'k, but if I put russian letters there - it recodes into percentage format and searches nothing. If put russian letters into URL string - search works o'k. What I do wrong?

comment:9 by ebray, 11 years ago

I wonder if rather than reopening a 5 year old ticket it wouldn't be better to create a new one if this is truly a regression. I wonder if it's a browser-specific bug. I couldn't reproduce this on the latest Firefox.

comment:10 by Remy Blank, 11 years ago

Resolution: fixed
Status: reopenedclosed

Indeed. Please open a new bug with a precise description of how to reproduce the issue and the symptoms you observe.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain ebray.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from ebray to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.