#13614 closed enhancement (cantfix)
No linkification for link schemes where the scheme is not followed directly by '//'
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | wiki system | Version: | 1.5.3 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
I am trying to insert a link to an XMPP chatroom. This is generally similar to a mailto URI (which gets special case treatment in Trac), but with a different protocol.
I tried using the usual wiki syntax:
[xmpp:test@example.org?join An example link to an XMPP chatroom]
but this isn't getting linkified despite adding xmpp to the list of safe schemes in trac.ini. Looking into the sourcecode, it seems safe schemes are only considered if the scheme is followed with //
, which is not the case for XMPP links.
I have patched wiki/formatter.py to add a case to the _make_link
function:
... elif ns == "xmpp": return self._make_link('xmpp:'+target, label) ...
but I find the check of target starting with //
questionable. It also prevents other unusual but valid URL syntaxes.
Attachments (0)
Change History (5)
comment:1 by , 14 months ago
Description: | modified (diff) |
---|---|
Resolution: | → cantfix |
Status: | new → closed |
comment:2 by , 14 months ago
Ok, I can do that, but what is the reasoning for not doing it automatically for links that are in the "safe schemes" list?
The restriction that "safe schemes" links must also start with //
seems superfluous to me.
For example relative http links also won't work:
https:/ticket/13614
According to https://www.ietf.org/rfc/rfc3986.txt this should be allowed (section 3, see how 'hier-part' is defined in 4 possible ways, only one of which starts with //
). If you have a reason to not do it in Trac, I'd like to know what it is. Even if I end up having to write a plugin for this, I would rather try to not break things if there is a good reason for it to be this way?
I also find no documentation that explains this restriction on links.
comment:3 by , 14 months ago
Description: | modified (diff) |
---|
comment:4 by , 14 months ago
Trac converts a string to an external link when the string starts with scheme://
and the scheme is listed in [wiki] safe_schemes option. I couldn't find documentation for the behavior. See tags/trac-1.6/trac/wiki/formatter.py@:694-696#L672.
Also, to enable xmpp
link is that you could add xmpp xmpp:
entry to your InterMapTxt
page and add xmpp
to [wiki] safe_schemes
option. See #9016.
Trac core source shouldn't be patched. Instead, try to implement IWikiSyntaxProvider interface as a Trac plugin.
Also, please ask on trac-users mailing list for support questions.