Opened 9 years ago
Last modified 14 months ago
#12238 new defect
InterWiki prefix with http works with more symbols then links defined without http
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | next-stable-1.6.x |
Component: | rendering | Version: | 1.0.7 |
Severity: | normal | Keywords: | InterMapTxt, prefix, InterWiki |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The following definition in the wiki:InterMapTxt will not work with all symbols:
kwquery /query?group=status&keywords=~ # Custom query for tickets matching keyword $1
in comparison to any prefix using http, e.g.
PEP http://www.python.org/peps/pep-$1.html # Python Enhancement Proposal
Example
Works
Not working using an extra :
kwquery:foo:bar
Works
Attachments (0)
Change History (9)
comment:1 by , 9 years ago
Milestone: | → next-stable-1.0.x |
---|
comment:2 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:3 by , 8 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
No, no. This is not a safe_schemes issue.
comment:4 by , 8 years ago
It clearly fixes the issue and save_schemes is a list of URI schemes considered "safe", that will be rendered as external links.
foo:bar is not safe because it needs to be defined as such.
If is not in safe_schemes issue please define what it is.
comment:6 by , 8 years ago
After the patch, kwquery:foo:bar
would be rendered as /query?group=status&keywords=~foo%3Abar
link.
-
trac/wiki/interwiki.py
diff --git a/trac/wiki/interwiki.py b/trac/wiki/interwiki.py index 4132dfcff..768c50f11 100644
a b from trac.cache import cached 22 22 from trac.config import ConfigSection 23 23 from trac.core import * 24 24 from trac.util import lazy 25 from trac.util.text import unicode_quote 25 26 from trac.util.translation import _, N_ 26 27 from trac.wiki.api import IWikiChangeListener, IWikiMacroProvider, WikiSystem 27 28 from trac.wiki.parser import WikiParser … … class InterWikiMap(Component): 69 70 """Replace "$1" by the first args, "$2" by the second, etc.""" 70 71 def setarg(match): 71 72 num = int(match.group()[1:]) 72 return args[num - 1]if 0 < num <= len(args) else ''73 return re.sub(InterWikiMap._argspec_re,setarg, txt)73 return unicode_quote(args[num - 1]) if 0 < num <= len(args) else '' 74 return InterWikiMap._argspec_re.sub(setarg, txt) 74 75 75 76 def _expand_or_append(self, txt, args): 76 77 """Like expand, but also append first arg if there's no "$".""" 77 78 if not args: 78 79 return txt 79 80 expanded = self._expand(txt, args) 80 return txt + args[0]if expanded == txt else expanded81 return txt + unicode_quote(args[0]) if expanded == txt else expanded 81 82 82 83 def url(self, ns, target): 83 84 """Return `(url, title)` for the given InterWiki `ns`.
comment:7 by , 8 years ago
Milestone: | next-stable-1.0.x → next-stable-1.2.x |
---|
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.
comment:8 by , 5 years ago
Milestone: | next-stable-1.2.x → next-stable-1.4.x |
---|---|
Status: | reopened → new |
Open trac.ini, goto section wiki, add foo to safe_schemes, save and restart server.
https://trac.edgewall.org/wiki/TracIni