1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Fix endless redirects in some circumstances

Co-authored-by: Joshix-1 <57299889+Joshix-1@users.noreply.github.com>
This commit is contained in:
Eugen Rochko 2024-01-16 20:05:27 +01:00
parent b9b78e6ad2
commit 516561745f

View file

@ -122,6 +122,11 @@ class StatusContent extends PureComponent {
} else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) { } else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) {
link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false); link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false);
link.setAttribute('href', `/tags/${link.text.replace(/^#/, '')}`); link.setAttribute('href', `/tags/${link.text.replace(/^#/, '')}`);
} else if (status.get('uri') === link.href) {
// the link points to the source of the status. this happens e.g. with lemmy posts.
// there is no use in trying to open the url on this instance as it's already opened.
link.setAttribute('title', link.href);
link.classList.add('unhandled-link');
} else { } else {
link.setAttribute('title', link.href); link.setAttribute('title', link.href);
link.setAttribute('href', `/redirect?url=${encodeURIComponent(link.href)}`); link.setAttribute('href', `/redirect?url=${encodeURIComponent(link.href)}`);