Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post language strings with country code are invalid according to BCP47 #27194

Closed
TheEssem opened this issue Sep 28, 2023 · 1 comment · Fixed by #27207
Closed

Post language strings with country code are invalid according to BCP47 #27194

TheEssem opened this issue Sep 28, 2023 · 1 comment · Fixed by #27207
Labels
bug Something isn't working status/to triage This issue needs to be triaged

Comments

@TheEssem
Copy link
Contributor

Steps to reproduce the problem

  1. Create a post with the language set to a locale with a country code (e.g. zh-HK)
  2. Obtain the JSON-LD of the post (e.g. using curl -H "Accept: application/json")
  3. Note the keys of the contentMap object

Expected behaviour

The first key of the object should be a valid locale string in accordance with BCP47 (e.g. zh-HK)

Actual behaviour

The first key is in camel-case without a hyphen (e.g. zhHk)

Detailed description

Introduced by #27099. It seems like this is how languages are currently stored in the database, so some conversion is likely needed before sending a post to inboxes.

Mastodon instance

No response

Mastodon version

No response

Technical details

  • Ruby version: 3.2.2
  • Node.js version: 18.17.1
@TheEssem TheEssem added bug Something isn't working status/to triage This issue needs to be triaged labels Sep 28, 2023
@ClearlyClaire
Copy link
Contributor

This is most likely caused by app/lib/activitypub/adapter.rb, and new because of #27099 allowing for keys that would actually get transformed.

I'll see how to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status/to triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants