Quoting across discourse instances with links getting process as local links

Before I get into this, I want to mention that I was going to try duplicating this on try.discourse, but it appears to be offline. Since I didn’t want to pollute things experimenting here, I’m just presenting what I found at WTDWTF.

Ok, basic description. Generally when quoting a post by using a link, you get pretty reliable results. However, when I have been trying to quote posts from here over at WTDWTF, I’ve been getting 1 of 2 results:

  1. The topic ID and post number are parsed from the link, and then the relevant post from WTDWTF is wuoted instead of the post from here. [Example]
  2. The link is left bare. Base on experimentation, it appears that this is because the corresponding topic at WTDWTF is restricted access, or the corresponding post does not exist. [Example]

Let’s see what happens here when I try to link to the corresponding bug report at WTDWTF:


Looks like the link is bare because no corresponding topic exists here. Let’s try with a link to an older WTDWTF topic:



Well yeah because anons can’t see bug topics there, right? Hmm, no, I can get to that topic in incognito mode.

It seems that if the parser sees anything that resembles a discourse link, it just assumes that it is for the local instance. It just grabs the topic ID and post number and ignores the rest. For example, this won’t resolve at all: https://chicken/t/pox/26672/2. But if you put it in a post for onebox quoting:



I see that is much clearer probably a regression. @eviltrout you should add that to your list.

Potentially Definitely related to the change I just made?



A fix might be to replace true with super - in that case, it’ll check for Discourse.base_url as well.

Or stick return false unless super at the start of the method.

Here’s a fix: