From 3798d9ddb924cdd2818751c3e00c8a4422dbe26c Mon Sep 17 00:00:00 2001 From: Alain St-Denis Date: Wed, 22 Feb 2023 15:08:22 -0500 Subject: [PATCH] Strip query from Hashtag objects href property for platform that don't use the same href in the content (pixelfed). --- federation/entities/activitypub/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/federation/entities/activitypub/models.py b/federation/entities/activitypub/models.py index 0b3b03e..c4cf8a8 100644 --- a/federation/entities/activitypub/models.py +++ b/federation/entities/activitypub/models.py @@ -840,7 +840,13 @@ class Note(Object, RawContentMixin): def remove_tag_links(attrs, new=False): # Hashtag object hrefs href = (None, "href") - if attrs.get(href, "").lower() in hrefs: + url = attrs.get(href, "").lower() + if url in hrefs: + return + # one more time without the query (for pixelfed) + parsed = urlparse(url) + url = f'{parsed.scheme}://{parsed.netloc}{parsed.path}' + if url in hrefs: return # Mastodon