Hi,

I'm developing a mobile site that makes use of tel: URLs (eg. tel:+6421123456).

It seems Pathologic thinks these are relative links and rewrites them to http://my.domain/tel%3A%206421123456

I see there's an existing exemption for mailto:, I guess this one just needs to be recognised too.

Note there's several schemes that aren't followed by a slash, documented pretty well at http://en.wikipedia.org/wiki/URI_scheme

It may pay to ignore some others, like xmpp:, telnet:, sip:, etc as well.

CommentFileSizeAuthor
patologic.telscheme.patch1.02 KBneilnz

Comments

Garrett Albright’s picture

I've run into this sort of thing before. See, the problem is that the colon is a valid character in relative paths as well. For example, discussion pages for Wikipedia article use a path in the format Talk:[Article name]. So apart from making a big (possibly customizable?) list of prefixes we should interpret as protocols, I'm not sure what to do - and even that probably wouldn't be the best solution, because what if someone wants to legitimately make "tel:" part of a path?

Thanks for bringing it back to my attention, though. I'll ponder over it.

neilnz’s picture

Are there ever relative URLs that point at something like Wikipedia? Does any Drupal module use a colon in paths?

Another option would be to duplicate the textarea for declaring local prefixes with one for "not local" ones that should be ignored, then just incorporate those prefixes into the pattern. I guess the only problem here is that people wouldn't necessarily realise which module is rewriting their links (I had to probe a little to find out myself), so they wouldn't know to go there to set the prefix.

Third option is to (like you say) just complete the list of currently specified protocols. You could put them in an include file for ease of maintenance, then compile them into the regex.

Garrett Albright’s picture

Are there ever relative URLs that point at something like Wikipedia? Does any Drupal module use a colon in paths?

Modules probably wouldn't put colons in paths, but node authors and/or Pathauto could use one when specifying a path alias.

Third option is to (like you say) just complete the list of currently specified protocols. You could put them in an include file for ease of maintenance, then compile them into the regex.

Does such a list exist? Should I compile my own? Should it include proprietary but somewhat common protocols such as "aim:"? Should it contain non-proprietary but uncommon ones such as… well, "tel:"? This is the dilemma…

The blacklist approach is probably the one I'll end up taking.

Garrett Albright’s picture

Status: Needs review » Closed (fixed)

This shouldn't be happening anymore.