Fixed Fix handling of "tel:" URLs

Steffen

Well-known member
Affected version
2.0.11
When you try to post a "tel:" URL like [URL='tel:123456']Call me![/URL] then XenForo prepends the absolute forum URL to it. Needless to say, this breaks, the "tel:" URL. I think XenForo should either fix the handling of "tel:" URLs or strip them completely.

I'm in favor of stripping them because of two reasons: 1) They could be abused and don't seem to be used anyway (they are currently broken any no-one seems to have noticed). 2) Mobile Safari sometimes seems to create them automagically where they don't make any sense at all (see screenshot). Maybe this happens when copy-pasting (I'm not sure, I don't use iOS myself). But I see a couple of forum posts with useless (and broken) "tel:" URLs each week.

Diff:
--- a/src/XF/Html/Renderer/BbCode.php
+++ b/src/XF/Html/Renderer/BbCode.php
@@ -589,7 +589,7 @@ class BbCode
             return $text;
         }

-        if (preg_match('#^(data:|blob:|webkit-fake-url:|x-apple-data-detectors:)#i', $href))
+        if (preg_match('#^(data:|blob:|tel:|webkit-fake-url:|x-apple-data-detectors:)#i', $href))
         {
             return $text;
         }
 

Attachments

  • Screenshot from 2018-11-26 09-12-46.webp
    Screenshot from 2018-11-26 09-12-46.webp
    11.3 KB · Views: 17
With this meta tag you can disable auto-linking of (suspected) telephone numbers in your own forum. So it helps in the case when a Safari user copy-pastes text from your own forum into a new post. But I assume it won't help if a Safari user copy-pastes text from other websites (that don't use this meta tag) into a new post. :(
 
The auto linking in Safari isn't actually anything to do with copy/pasting, it actually scans the page for telephone number like strings and automatically links them as a tel link. I find it mightily annoying myself...
 
The screenshot in the first post doesn't show links that Safari just added on-the-fly. In fact, the screenshot doesn't show Safari but Google Chrome. The links exist as BB code in the post markup. I suspect that they ended up there because a Safari user copy-pasted text from another site (where Safari automagically added those "tel:" links).
 
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XF release (2.0.12).

Change log:
Prevent tel/sms links being converted to bbcode
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Is there no support for tel URLs? It looks like they are just being stripped. mailto is supported by default. I see no reason why we should not support tel in the same way.
 
Last edited:
Top Bottom