fix(i18n): make language pack endpoint public for embedded dashboards#42438
fix(i18n): make language pack endpoint public for embedded dashboards#42438prathamesh04 wants to merge 1 commit into
Conversation
Remove @has_access from the /language_pack/<lang>/ endpoint to allow embedded dashboards to fetch translations without authentication. Embedded dashboards use a bare fetch() without the guest-token header, so the endpoint returned a 302 redirect to /login/ instead of the translation catalog. This silently broke i18n for all embedded dashboards using non-English locales. The language pack contains only non-sensitive translation strings and is safe to serve without authentication. Closes apache#42433
Code Review Agent Run #32e7e7Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #42438 +/- ##
==========================================
- Coverage 65.23% 56.60% -8.63%
==========================================
Files 2795 2795
Lines 157694 157693 -1
Branches 36067 36067
==========================================
- Hits 102871 89266 -13605
- Misses 52847 67602 +14755
+ Partials 1976 825 -1151
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Closes #42433
The
/language_pack/<lang>/endpoint was protected by@has_access, which caused a 302 redirect to/login/for unauthenticated requests. This silently broke i18n for all embedded dashboards using non-English locales.Embedded dashboards use a bare
fetch()without the guest-token header, so the async language pack fetch inpreamble.tswas always blocked. The bootstrap-injected pack path (common_bootstrap_payload) also depends on the JSON catalogs existing on disk - the official Docker image ships only.pofiles, so when the pack isNonethe fallback fetch was the only path to load translations, and it was broken.Root Cause
@has_accessblocks embedded guest users: The language pack endpoint requires authenticated access. The embedded SPA barefetch()has no guest-token header so it gets a 302 to/login/messages.jsonfiles are not shipped, soget_language_pack()returnsNone, making the bootstrap-injected pack empty/null@has_accessFix
@has_accessfrom thelanguage_packendpoint (translation data is non-sensitive)Testing Instructions
pytest tests/unit_tests/views/test_base.py::test_language_pack_endpoint_is_public -vpytest tests/unit_tests/views/test_base.py -v