Open mxamber opened 1 year ago
this still happens on 3.5.3+glitch, e.g., https://glitch.cat.family/@aescling/108910048909555291
(edit: just to make sure i tested again after recently merging in from Glitch and https://glitch.cat.family/@aescling/108952961487825158 shows this behavior still happens)
Preventing such links from being crawled and generating a preview card may be difficult, as the link and mention detection happen on the raw text, and, for some edge cases, need to be able to modify it (so we can't just pass it through a markdown processor to remove code blocks entirely).
Not rewriting the link itself should be doable, although I'm not quite sure which part of the code causes that. In any case, that happens in https://github.com/glitch-soc/mastodon/blob/main/app/lib/advanced_text_formatter.rb but it could be from the markdown parser, or our rewrite
(https://github.com/glitch-soc/mastodon/blob/main/app/lib/advanced_text_formatter.rb#L78) method. I think it may be the latter, in which case the best way to deal with that may be to change the regexp to skip code blocks.
I'm fairly busy with upstream work these days, so I might take a while to tackle this. In the meantime, PRs are welcome (though I'm not sure either how much time I can put in reviewing them).
Steps to reproduce the problem
https://example.com
Expected behaviour
The link address should be displayed in full but not function as an actual link.
Actual behaviour
The http(s):// prefix is removed and the link is truncated if particularly long.
Specifications
Mastodon 3.5.2+glitch, occured specifically on eldritch.cafe (see here for examples).
See also: #1455 (links in code blocks create link previews)