Inconsistent link behaviour
-
I think we've reported this before?
?
Left-click: error.
Middle-click: works.Note: Link leads to a thread in the Lounge, so you need to be at least TL3 to get to it
-
Well it breaking makes sense. I did something totally unsupported.
I put a link in an<a>
tag.Wait a second...
-
All things I can do on my laptop cause the error.
Left click: error.
Ctrl+left click: error.
Right click, open in new tab: error.edit: and three finger tap: error.
-
-
Copying and pasting that URL into a new incognito window gives an error too, so it's something wrong with the URL or the page it tries to generate.
-
For you it should say something along the lines of 'access denied', which is normal, as it's a Lounge thread, which you haven't yet earned the right to access
-
Oh, that'll be why it always errors then.
However - it's always this.
-
Where does it say "access denied"? Is it written in white text?
-
Oh yeah, that's the wrong result; looks like @LB_ has the same issue
-
This is what it should be:
-
Nope, it doesn't matter whether I am logged in or not, I just get the error. Google Chrome Version 45.0.2454.85 m (64-bit)
-
Actually that might be the discocorrect message. There could be a bug throwing up the wrong message
-
Sadly this isn't the first time a bug has been discovered while reporting another bug.
-
I think that's it...
-
-
Huh.
First one errors on left click only, second one works
-
The
slug
version gives the access denied message. When logged out, it asks to log in.
-
And that's the wonders of Discourse ;)
-
-
In theory, the
slug
part (normally the topic title) is optional; however, the processing is fucked up, so omitting the slug hits a different error condition
-
What tops the discoursistancy cake though, is the fact that it breaks even for logged in users... at least, until you middle mouse click it...
-
Isn't that a years-old WONTFIX TOOLAZY OHHEYABIKESHED?
Thing is, when you open the link with a middle-click, you load its
href
. Saidhref
is the shortened version of the link (t/nnnn
), but that's okay, because Discourse's controller for that route simply issues a301 Moved Permanently
and redirects you to the proper, slugged link.Problem is, when you left-click, you run Discourse's magic click handler instead. That, instead of simply redirecting you to the
t/xxxx
controller, attempts to handle retrieving the slug client-side, and then load the page via AJAX. To do that, it first AJAXes tot/id_for/nnnn
, which calls a different controller:def id_for_slug topic = Topic.find_by(slug: params[:slug].downcase) guardian.ensure_can_see!(topic) raise Discourse::NotFound unless topic render json: {slug: topic.slug, topic_id: topic.id, url: topic.url} end
Which is all fine-and-dandy, but Discourse somehow (haven't pinned it down) chokes when sent an
X-Requested-With: XMLHttpRequest
header on that call.
-
TIL I'm TL3. Nifty?
Checking shadowmods...