I went to link a topic from another topic and noticed that [link](/t/45202) produces the error
Access Denied while trying to load /t/id_for/14
However [link](/t/blah/45202) works fine. I believe this is a bug.
The discussion addresses an inconsistency in Discourse topic URL handling regarding the requirement of a slug. jhands reported that internal links using the format [link](/t/45202) result in an “Access Denied” error, whereas including a slug placeholder like [link](/t/blah/45202) works correctly. tobiaseigen initially clarified that the slug segment is intended to be required, noting that any value can be placed there. jhands countered that fully qualified external URLs (e.g., https://meta.discourse.org/t/45202) function without a slug, creating a discrepancy. codinghorror observed that the error also depends on interaction method, noting the link works if opened in a new tab. jhands argued that since the slug requirement cannot be removed globally without breaking existing links, the system should be fixed to allow t/1234 formats within the same site for consistency. johnmuhl linked this to a previous discussion titled “Title links only work if the slug is present,” which jhands confirmed was the same issue. jhands further questioned why slugs are optional for full URLs if a 1-character minimum is enforced internally. tobiaseigen acknowledged this as a valid point, admitting they were unaware of the behavior with fully qualified links and speculated it might be unintended “URL hacking” that previously did not work.
I went to link a topic from another topic and noticed that [link](/t/45202) produces the error
Access Denied while trying to load /t/id_for/14
However [link](/t/blah/45202) works fine. I believe this is a bug.
actually this is intended behavior. you have to have something in the blah spot in the URL. You can put whatever you want in there.
But why don’t you have to put something in blah when linking the full address? https://meta.discourse.org/t/45202 when you link on anything other than discourse. (Put that up in the address field of browser and it will work.)
I see what you are saying now. It also works if you open in new tab vs click directly.
Yes exactly. It can’t exactly be removed now since it’d break a lot of links to discourse sites. So I think it should be fixed to allow t/1234 within the same Discourse site for consistency.
Seems similar to:
Yeah that’s the same issue (I couldn’t find that when searching.)
@codinghorror says there that a slug of at least 1 character is required. If that’s the case, how did it end up that slugs aren’t required for fully qualified links?
that’s a good point and I wasn’t aware of it. I don’t think this used to work and I’m not sure why it does.
nice URL hacking! ![]()