Duplicate link detection ignores anchor

Zulip links to specific discussions put lots of information in the anchors, and the only thing before the anchor is the top-level domain (such as rust-lang.zulipchat.com). Discourse seems to ignore the anchor when doing duplicate link detection, which results in messages like this:

It looks like your link to rust-lang.zulipchat.com was already posted in the topic by @josh in a reply on Jun 3, '20 – are you sure you want to post it again?

That link has a different anchor, so it shouldn’t count as a duplicate.

That’s debatable. I would argue linking to the same page over and over again, even if the anchor is different, should get a warning.

1 Like

For web apps like Zulip that put all information into the anchor, that effectively makes Discourse consider every link to the app a duplicate link.

1 Like

I took a look at this and it’s quite strange but I can’t reproduce it. There is no obvious code that strips off the URL hash when normalizing links. We do strip off trailing slashes, and I found a bug where we should be ignoring case in the URL but aren’t.

https://github.com/discourse/discourse/pull/11436

In the example you linked to, it looks like the link was oneboxed to a /login link. In that case all login links would be the same. Is that the problem?

2 Likes

I think that’s a separate issue. The underlying URL is distinct, and I’m not sure why the preview box is changing it to /login.

That said, I can no longer reproduce this issue either.

1 Like

Great news, I’ll close for now.