Validate BCP47 language tags with a regex by azmeuk · Pull Request #873 · authlib/authlib
I realized that I provided invalid language tags (with underscores), and that caused errors in clients during discovery (that was matrix-authentication-service).
OpenID Connect Core section 5.1
locale string End-User's locale, represented as a BCP47 [RFC5646] language tag. This is typically an ISO 639 Alpha-2 [ISO639] language code in lowercase and an ISO 3166-1 Alpha-2 [ISO3166‑1] country code in uppercase, separated by a dash. For example, en-US or fr-CA. As a compatibility note, some implementations have used an underscore as the separator rather than a dash, for example, en_US; Relying Parties MAY choose to accept this locale syntax as well.
Note that with this PR underscore are rejected by Authlib.
Checklist
- The commits follow the conventional commits specification.
- You ran the linters with
prek. - You wrote unit test to demonstrate the bug you are fixing, or to stress the feature you are bringing.
- You reached 100% of code coverage on the code you edited, without abusive use of
pragma: no cover - If this PR is about a new feature, or a behavior change, you have updated the documentation accordingly.
- You consent that the copyright of your pull request source code belongs to Authlib's author.