Left clicking /raw/ links return 404 errors

(PJH) #1

Continuing the discussion from Hyperlinking email addresses in monospaced formatted text:

Left clicking raw links return a 404. Middle/ctrl clicking produces the desired result…

For your testing porpoises - link to this post: https://meta.discourse.org/raw/31314/1

Clicking link to raw version of post only works when opening in new tab
Left-clicking same-domain links to URLs not on the whitelist is broken
Bug: raw links generate error and require reloading
(Jeff Atwood) #2

Correct, anything not rendered by Ember will behave that way. This is raw, no HTML even.

(also right click and open in new tab works fine as well)

We’d have to wrap it in Ember somehow for it to work with the click routing.

(Sam Saffron) #3

It’s a legit bug in our ember routing, we should fix

(Felix Freiberger) #4

There’s even more trouble: Click the link. Hit F5 to actually load it. Press . Surprise: The URL changes, but you don’t get back to Discourse.

(David Grayson) #5

With my limited understanding, it seems like if the Discourse/Ember router does not recognize a URL, then it should trigger a full page load of that URL in order to give other parts of the stack a chance to respond to the URL instead (e.g. your web server or your back-end application). Is there a reason why this is not being done?

(Jeff Atwood) #6

It’s a rare need – why and how often are you linking to raw versions of posts, exactly? – but I want to ask @eviltrout if there is any way to easily work around the problem.

The workaround is also pretty simple, just right or middle click. (Or tap-and-hold on mobile, etc)

(David Grayson) #7

I don’t need the raw links very often, but I do use them to help show other people how to use Markdown. Also, being able to link to the RSS feeds and categories of a forum is important, and those links are broken because of this bug. If you have RSS feeds and categories but you cannot link to them, then it makes it pretty hard to tell people about them.

This issue has been posted at least 5 times, and the number of distinct users who either posted or liked one of those posts is currently 10.

The only good workaround is to use something like TinyURL.com. People reading my posts will not know that they have to middle click; they will assume that I posted a bad link.

Left-clicking same-domain links to URLs not on the whitelist is broken
(Mittineague) #8

That demonstrates the rarity. Of 21704 members, that’s a mighty low percentage.


As posted, those that would be interested in seeing raw / json / rss are savvy enough to know how to do it.

If you want to use the results in a post the simple fool-proof ways are educating members or putting the example inside a code fence.
I see no compelling need to use tiny URLs, but I’m probably not understanding your use case.

(David Grayson) #9

My use case would be linking to some part of the forum that is not known to the Discourse/Ember router (RSS feed, categories, raw text) and letting users left-click on the link to see the content that I linked to, because that is how they are accustomed to following links.

Would this analogy make sense? Imagine you had a calculator that crashed when it encountered the number 3893831283381. Then imagine the developers of the calculator questioned how often that particular number is needed.

Would it make sense for me to appeal to the CommonMark standard? I kind of thought that users should be able to read that standard in order to understand what they can post on a Discourse forum, and I am pretty sure it does not mention anything about an Ember router breaking links.

(Mittineague) #10

Yes, I have a pocket calculator that every time I try to divide by zero gives me “- E -”, very frustrating. :wink:

But you do have a point. I think the post cooker code could be tweaked to show such URLs as URLs and not links.

That way when they’re copy-pasted into the address bar they will be guaranteed to work and no member education would be needed.

(Robin Ward) #11

It’s not hard to fix. We just haven’t come up with a good reason to do so yet.

(Jeff Atwood) #12

It’s a fair point, it has come up a lot, but the consequences are minor and there is a workaround. Maybe we can get to it in this release.

(Robin Ward) #15

Here’s a fix for it. We can whitelist server routes as “server side only”

Left-clicking same-domain links to URLs not on the whitelist is broken
(Robin Ward) #16