Incomplete topic titles beginning with a number can have odd behavior

סיכום מבוסס בינה מלאכותית

Users discuss a behavior in Discourse where topic URLs beginning with a number that matches an existing topic ID can cause unintended redirection. Jose_C_Gomez observes that a URL like https://meta.discourse.org/t/101646-12-42-interesting-bug-maybe (missing the topic ID) redirects to a different topic because 101646 matches another topic’s ID. maiki explains that without a topic ID, Discourse performs a lookup, which can be confused by leading numbers — though this isn’t necessarily a bug since Discourse typically includes topic IDs in URLs. Jose_C_Gomez notes it’s still odd because non-conflicting numeric titles work fine. maiki clarifies that the topic ID is what matters — the rest of the slug is parsed and can be edited without breaking links. Jose_C_Gomez insists that, generally, Discourse does resolve topics by title even without an ID. RGJ corrects that the full URL must include the topic ID (e.g., /153975), and that incomplete URLs are resolved by the number, leading to the confusion. In short: leading numbers in topic titles can clash with topic IDs, causing redirection issues — but this is expected behavior since Discourse relies on topic IDs for accurate routing.

If you put a title that starts with a number and that number coincides with a different topic ID. Then sharing or clicking on a direct link (without the post ID) automatically redirects you to the clashing topic.

For example this post title starts with 101646 which is the POST ID of another topic (this one)

But then if I post a link to this

https://meta.discourse.org/t/101646-12-42-interesting-bug-maybe

Copy paste works best for this example

Which is the URL of this (current) topic it redirects to the Topic List Preview (unless I provide the /153975) at the end.

However any other post I can l link to directly as long as they don’t have a shared ID at the beginning of the URL
IE:

https://meta.discourse.org/t/install-plugins-in-discourse

Redirects propely.

If it doesn’t have the topic ID, I’m sure it’s doing a lookup, and your number URL confuses that function.

Not sure it’s a bug, since Discourse doesn’t share URLs sans topic ID.

Sure mayhaps not a bug just an interesting observation. The link does work though if the number doesn’t clash… so still a bit odd

You just need the topic ID, the rest of it is parsed. For instance, this topic is available at https://meta.discourse.org/t/123-numbers-dont-mean-a-thing/153975.

That means you can fix errors in the title/URL, without having to fix existing links. Pretty neat. :slight_smile:

Interesting but if you don’t have a Topic ID it does (generally) find the right topic based on the title.

No, that is incorrect, the URL of this topic is
https://meta.discourse.org/t/101646-12-42-interesting-bug-maybe/153975, not https://meta.discourse.org/t/101646-12-42-interesting-bug-maybe/

So if you’re entering an incomplete topic URL then it will try to resolve it - using the number…