astro / buzzrelay

Source to relay.fedi.buzz: relay the streaming API of Mastodon instances
https://relay.fedi.buzz
GNU Affero General Public License v3.0
72 stars 10 forks source link

Tag name normalization causes actors to be served with an unexpected name #19

Open VyrCossont opened 3 months ago

VyrCossont commented 3 months ago

This was reported by GotoSocial user @chri2 in superseriousbusiness/gotosocial#3063. When they enter the tag name trööt in the relay URL page at https://relay.fedi.buzz/, the resulting actor URL is https://relay.fedi.buzz/tag/tr%C3%B6%C3%B6t. However, resolving that URL shows an actor where deunicode normalization results in the actor's ID actually being https://relay.fedi.buzz/tag/troot, and GtS currently rejects that as a match for the actual URL being queried, so the actor doesn't appear in search results.

Mastodon doesn't appear to care, and will show the deunicoded version of the actor in search results.

AP is vague enough on actor resolution that I'm not sure which, if not both, actor resolution behaviors are correct, so I'd like to propose a low-impact fix: apply a deunicode-equivalent transform in the page at https://relay.fedi.buzz/, so that entering trööt as a tag name would result in the actor URL https://relay.fedi.buzz/tag/troot being shown to the user.

astro commented 3 months ago

Thank you for the problem report.

The URL generation happens completely on the client side. Can you recommend a JavaScript library for Unicode denormalization?

VyrCossont commented 3 months ago

I'd try unidecode, which is derived from the same Text::Unidecode Perl module as deunicode.