Dubbele linkdetectie negeert anker

AI-generated summary

The discussion centers on a bug where Discourse’s duplicate link detection ignores URL anchors, causing links to Zulip (which store discussion context in anchors) to be flagged as duplicates even when they point to different content. joshtriplett reported that links like rust-lang.zulipchat.com#anchor are treated as identical to the base domain, triggering false duplicate warnings. eviltrout initially argued that repeated links to the same page—even with different anchors—should still trigger warnings, but later investigated and found no code explicitly stripping anchors. He identified a separate issue where oneboxing might redirect links to /login, potentially masking the original URL. joshtriplett confirmed the issue could no longer be reproduced, and eviltrout closed the report. A related fix for case-insensitive URL comparison was submitted in PR #11436.

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.