Bug(s) in Discourse handing of URIs in markdown content

I’ve just run into this bug with geo URI, which look like geo:36.95733984,-122.0172856.

I see there is an exception for tel URI:

    if (allowedHrefSchemes.includes("tel")) {
      extraHrefMatchers.push(new RegExp("^tel://\\+?[\\w\\.\\-]+", "i"));

There is Uniform Resource Identifier (URI) Schemes, but I used List of URI schemes - Wikipedia to check the schemes as they include examples. I’m look at the, um, scheme-name “suffix”, the :// (what is that called? “Scheme format”?).

From careful eyeballing, it seems there are only three patterns used:

  • ://
  • :/
  • :

My brain is having difficulty tracking where this is happening in relation to writing markdown and converting to href, but I think we if can figure out how to check for those three formats, we should be good for any scheme added by the admin.

No idea on how to validate per scheme… :thinking:


My unofficial code names for the formats:

  • : “observing”
  • :/ “skeptical”
  • :// - “double skeptical”
1 Like