Opened 20 years ago
Closed 20 years ago
#2172 closed defect (fixed)
TrackLinks broken
| Reported by: | Owned by: | Christian Boos | |
|---|---|---|---|
| Priority: | high | Milestone: | 0.9 | 
| Component: | general | Version: | 0.9b2 | 
| Severity: | major | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal 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)
Change History (5)
comment:1 by , 20 years ago
| Milestone: | → 0.9 | 
|---|---|
| Owner: | changed from to | 
comment:2 by , 20 years ago
| Status: | new → assigned | 
|---|
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 , 20 years ago
The following changes (using \s instead of spaces)
would fix the problem:
- 
      
trac/wiki/formatter.py
149 149 r"(?P<htmlescapeentity>!?&#\d+;)"] 150 150 _post_rules = [(r"(?P<shref>!?((?P<sns>%s):" % LINK_SCHEME + 151 151 r"(?P<stgt>'[^']+'|\"[^\"]+\"|" 152 r"(?:\|(?=[^| ])|&(?!lt;)|[^|& ])*[^|'~_\.,&\)])))"),152 r"(?:\|(?=[^|\s])|&(?!lt;)|[^|&\s])*[^|'~_\.,&\s\)])))"), 153 153 (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>'[^']+'|\"[^\"]+\"|[^\]]+))?\])"), 157 157 (r"(?P<macro>!?\[\[(?P<macroname>[\w/+-]+)" 158 158 r"(\]\]|\((?P<macroargs>.*?)\)\]\]))"), 159 159 r"(?P<heading>^\s*(?P<hdepth>=+)\s.*\s(?P=hdepth)\s*$)",  
by , 20 years ago
| Attachment: | oneliner_fixes_and_tests.patch added | 
|---|
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 , 20 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 



  
cboos, can you have a look at this?