Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

#2172 closed defect (fixed)

TrackLinks broken

Reported by: Karl <karl@…> Owned by: Christian Boos
Priority: high Milestone: 0.9
Component: general Version: 0.9b2
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:

Description

If the commit message below is used

ticket:1
This is a commit message for ticket:1 with additional comments

TimeLine and BrowseSource return this traceback

Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/web/standalone.py", line 235, in _do_trac_req
    dispatch_request(path_info, req, env)
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 139, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 107, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.3/site-packages/trac/Timeline.py", line 136, in process_request
    filters)
  File "/usr/lib/python2.3/site-packages/trac/versioncontrol/web_ui/changeset.py", line 131, in get_timeline_events
    message = wiki_to_oneliner(excerpt, self.env, db)
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 700, in wiki_to_oneliner
    OneLinerFormatter(env, absurls, db).format(wikitext, out)
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 639, in format
    result = re.sub(self.rules, self.replace, util.escape(text.strip(), False))
  File "/usr/lib/python2.3/sre.py", line 143, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 209, in replace
    return getattr(self, '_' + itype + '_formatter')(match, fullmatch)
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 255, in _shref_formatter
    return self._make_link(ns, target, match, match)
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 281, in _make_link
    return self.link_resolvers[ns](self, ns, target, label)
  File "/usr/lib/python2.3/site-packages/trac/ticket/api.py", line 160, in _format_link
    (target,))
ProgrammingError: ERROR:  invalid input syntax for integer: "1
This"

SELECT summary,status FROM ticket WHERE id='1
This'

Using Postgres

Attachments (1)

oneliner_fixes_and_tests.patch (21.5 KB ) - added by Christian Boos 14 years ago.
In addition to the previous fix, I integrated the suggestion made in #1153, as well as a complete set of unit-tests for the Wiki one-liner formatter (checked the results, not all unit-tests need to be repeated for the one-liner case, though)

Download all attachments as: .zip

Change History (5)

comment:1 by Christopher Lenz, 14 years ago

Milestone: 0.9
Owner: changed from Jonas Borgström to Christian Boos

cboos, can you have a look at this?

comment:2 by Christian Boos, 14 years ago

Status: newassigned

I can reproduce the issue with SQLite, though it doesn't result in a SQL error there. In the timeline there's a bogus ticket:1 This link…

comment:3 by Christian Boos, 14 years ago

The following changes (using \s instead of spaces) would fix the problem:

  • trac/wiki/formatter.py

     
    149149                  r"(?P<htmlescapeentity>!?&#\d+;)"]
    150150    _post_rules = [(r"(?P<shref>!?((?P<sns>%s):" % LINK_SCHEME +
    151151                    r"(?P<stgt>'[^']+'|\"[^\"]+\"|"
    152                     r"(?:\|(?=[^| ])|&(?!lt;)|[^|& ])*[^|'~_\.,& \)])))"),
     152                    r"(?:\|(?=[^|\s])|&(?!lt;)|[^|&\s])*[^|'~_\.,&\s\)])))"),
    153153                   (r"(?P<lhref>!?\[(?:(?P<lns>%s):" % LINK_SCHEME +
    154                     r"(?P<ltgt>'[^']+'|\"[^\"]+\"|[^\] ]*)"
    155                     r"|(?P<rel>[/.][^ [\]]*))"
    156                     r"(?: (?P<label>'[^']+'|\"[^\"]+\"|[^\]]+))?\])"),
     154                    r"(?P<ltgt>'[^']+'|\"[^\"]+\"|[^\]\s]*)"
     155                    r"|(?P<rel>[/.][^\s[\]]*))"
     156                    r"(?:\s+(?P<label>'[^']+'|\"[^\"]+\"|[^\]]+))?\])"),
    157157                   (r"(?P<macro>!?\[\[(?P<macroname>[\w/+-]+)"
    158158                    r"(\]\]|\((?P<macroargs>.*?)\)\]\]))"),
    159159                   r"(?P<heading>^\s*(?P<hdepth>=+)\s.*\s(?P=hdepth)\s*$)",

by Christian Boos, 14 years ago

In addition to the previous fix, I integrated the suggestion made in #1153, as well as a complete set of unit-tests for the Wiki one-liner formatter (checked the results, not all unit-tests need to be repeated for the one-liner case, though)

comment:4 by Christian Boos, 14 years ago

Resolution: fixed
Status: assignedclosed

Unit-tests added in r2393, and issue fixed in r2395.

Modify Ticket

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