Edgewall Software
Modify

Opened 7 weeks ago

Closed 7 weeks ago

#13914 closed defect (fixed)

quick-jump search not working with diff: links

Reported by: David Matthews Owned by: Jun Omae
Priority: normal Milestone: 1.6.1
Component: search system Version: 1.6
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed html-escaped URL which is redirected from the quickjump.

API Changes:
Internal Changes:

Description

If you enter diff:@1:3 into search, Trac displays changeset 3 rather than the expected diff (diff:@1:3).

Note: The page displays a notice saying "You arrived here through the quick-jump search feature. To instead search for the term diff:@1:3, click here." If you follow that link then that page shows a quickjump link which works correctly.

I've tested this on the 1.4 and 1.6 demo Trac's and they both have this problem. I have previously used this feature with Trac 1.0 when it worked as expected.

Attachments (0)

Change History (2)

comment:1 by Jun Omae, 7 weeks ago

Milestone: 1.6.1
Owner: set to Jun Omae
Status: newassigned

Good catch! This issue began occurring in Trac 1.4 which the template engine is switched from Genshi to Jinja2.

  • trac/search/web_ui.py

    diff --git a/trac/search/web_ui.py b/trac/search/web_ui.py
    index 27cb6d528..29b1aa26c 100644
    a b class SearchModule(Component):  
    180180            context = web_context(req, 'search')
    181181            link = find_element(extract_link(self.env, context, kwd), 'href')
    182182            if link is not None:
    183                 quickjump_href = link.attrib.get('href')
     183                quickjump_href = link.attrib.get('href').unescape()
    184184                name = link.children
    185185                description = link.attrib.get('title', '')
    186186        if quickjump_href:

We need to investigate whether similar issues exist on the following locations:

$ git grep '\.attrib[.\[]'
contrib/checkwiki.py:            mark = 'missing' in rv.attrib.get('class').split()
trac/mimeview/rst.py:                uri = elt.attrib.get('href', '')
trac/mimeview/rst.py:                missing = 'missing' in elt.attrib.get('class', '').split()
trac/search/web_ui.py:                quickjump_href = link.attrib.get('href').unescape()
trac/search/web_ui.py:                description = link.attrib.get('title', '')
trac/util/html.py:                    self.attrib.update(d)
trac/util/html.py:                v = self.attrib[k]
trac/util/html.py:        if cls is not None and cls in frag.attrib.get('class', '').split():
trac/wiki/formatter.py:                class_ = text.attrib.get('class', '')
trac/wiki/intertrac.py:            href = elt.attrib.get('href').unescape()
trac/wiki/macros.py:                    link = elt.attrib.get('href')
tracopt/versioncontrol/svn/tests/svn_fs.py:                href = a.attrib.get('href')
tracopt/versioncontrol/svn/tests/svn_fs.py:                title = a.attrib.get('title')

comment:2 by Jun Omae, 7 weeks ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed this issue and the same issue in trac.mimeview.rst in [17969] and merged in [17970].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae 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.