reproduce with
Edit a post and use the link-tool. Past a relative URL in, for example /g/moderators
should be legit on any Discourse install.
The link tool generates the Markdown for a link, but expands the relative URL to have “https://“ at the front.
Publish and discover that the final, generated link displayed isn’t actually a clickable link.
Just like dis here link that’s borked.
*sad trombone*
wait wat, scheme:///path
?
My BNR is rusty, but I believe RFC 1808 says Scheme, without authority, and with a path, is legit. aka https:///g/moderators
is totally legit. A few online URL parsers I tried agree. So I think (such admittedly odd-looking URLs) should be just fine, as the HREF’s attribute value on an A tag.
Thus the Link tool in the editor isn’t technically borking the URL. The error is in the cook/render/whatever-phase.
work around is dead simple of course
In email with staff, the word is: “That’s how it works.”
Just write markdown myself and use the relative URL.
Or notice the Link tool has its fingers in my soup, and edit the https://
off, directly in the post editor to be the relative URL I entered.
…but it is quicker to cmd|ctr-c some URL, type words, opt-shift-arrow over some words, hit cmd-k, cmd-v, enter and it’s all linked up.
the fix
I think this should be fixed via (best fix first)…
- don’t auto-complete relative URLs in the link tool (ie fix link tool)
- if you insist on having the link tool rewrite to add the Scheme (which does nothing since browsers would use the same Scheme anyway if the URL is relative) then make such odd-looking-but-correct
scheme:///path
URLs cook (is that the right verb?) correctly in the final HTML rendering so the link works (fix final cook/rendering) - no? okay, then make the Link tool autocomplete the URL with the actual
scheme://authority
when it sees a relative URL (this is probably the change that would seem clear to the broadest user-base: The vast number of Discourse users who wouldn’t be pasting in relative paths, versus the probably more-tech-savvy forum staff, admins, and moderators who are very small in number comparatively, but who would understand what it did when they do.) - srsly? okay then disallow putting a relative URL into the link tool (but this is just mean and forces people to break their
cmd|ctl—k
habit.) - add this to the list of broken things that aren’t a priority