Link’s href is cut off after 500 characters

I have a big 1400 character long link here.

If I inspect the document, it’s saved OK in Discourse.
If I right click copy HREF then open new tab paste it and Enter it works OK too.

But if I click it, the HREF URL will get trimmed after 500 characters and I will see an error page…

It must has to do with the click tracker.

※ I’m on Windows, I have tested Opera 12, Firefox, Chromium, IE11.

You could have picked a better time no?

MB will remain in read-only mode for another 8-12 hours while the team gets some rest. Sorry!

The server is temporarily in read-only mode for database maintenance.

I suggest using a link shortener like http://goo.gl if you need to post URLs that large.

1 Like

Sorry I didn“t have any other long URL handy than the one where I spotted the bug on

  1. Right click copy the long link, paste in a notepad, check the length → 1400 characters.
  2. Click the long link, then whatever the page display, copy the URL from the address bar and paste it in the same notepad and check its length → 500 characters.

I think that says it all :arrow_down: :wink:

https://github.com/discourse/discourse/blob/master/app/models/topic_link.rb#L10-L12

3 Likes

Thanks

I see what you mean.

https://musicbrainz.org/search/edits?negation=0&combinator=or&conditions.3.field=id&conditions.3.operator=%3D&conditions.3.args.0=38846344&conditions.4.field=id&conditions.4.operator=%3D&conditions.4.args.0=38846371&conditions.5.field=id&conditions.5.operator=%3D&conditions.5.args.0=38846374&conditions.6.field=id&conditions.6.operator=%3D&conditions.6.args.0=38846554&conditions.7.field=id&conditions.7.operator=%3D&conditions.7.args.0=38843739&conditions.8.field=id&conditions.8.operator=%3D&conditions.8.args.0=38846557&conditions.9.field=id&conditions.9.operator=%3D&conditions.9.args.0=38846753&conditions.10.field=id&conditions.10.operator=%3D&conditions.10.args.0=38846877&conditions.11.field=id&conditions.11.operator=%3D&conditions.11.args.0=38846956&conditions.12.field=id&conditions.12.operator=%3D&conditions.12.args.0=38847027&conditions.13.field=id&conditions.13.operator=%3D&conditions.13.args.0=38847058&conditions.14.field=id&conditions.14.operator=%3D&conditions.14.args.0=38847098&conditions.15.field=id&conditions.15.operator=%3D&conditions.15.args.0=38847118&conditions.16.field=id&conditions.16.operator=%3D&conditions.16.args.0=38847136&conditions.17.field=id&conditions.17.operator=%3D&conditions.17.args.0=38847141&conditions.18.field=id&conditions.18.operator=%3D&conditions.18.args.0=38847192&conditions.19.field=id&conditions.19.operator=%3D&conditions.19.args.0=38847259
https://musicbrainz.org/search/edits?negation=0&combinator=or&conditions.3.field=id&conditions.3.operator=%3D&conditions.3.args.0=38846344&conditions.4.field=id&conditions.4.operator=%3D&conditions.4.args.0=38846371&conditions.5.field=id&conditions.5.operator=%3D&conditions.5.args.0=38846374&conditions.6.field=id&conditions.6.operator=%3D&conditions.6.args.0=38846554&conditions.7.field=id&conditions.7.operator=%3D&conditions.7.args.0=38843739&conditions.8.field=id&conditions.8.operator=%3D&condi

compared to

2 Likes

Maybe there is no URL ID in the DB and the URL itself acts as the key, thus the size limit…

We just don’t support long URLs.

If you want to use URLs with more than 500 characters, then use a URL shortener like @codinghorror suggested.

1 Like