You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(core): preserve locale casing in API locale filter (#1551) (#2174)
* fix(core): preserve locale casing in API locale filter (#1551)
The `localeCode` validator lowercased the `?locale=` filter and create-body
locale, but config `locales`/`defaultLocale`, the stored `locale` column, and
the public query path all keep the raw BCP-47 casing. As a result the content
and search APIs returned zero rows for any locale with an uppercase region or
script subtag (e.g. zh-TW, pt-BR, zh-Hant).
Drop the `.toLowerCase()` transform so the value is preserved verbatim;
validation stays case-insensitive. This also matches the sibling
`localeFilterQuery` (taxonomies/menus), which never lowercased.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(core): apply localeCode validation to taxonomy/menu locale filter (#1551)
The shared `localeFilterQuery` (used by taxonomy and menu endpoints) still
used a plain `z.string()` while `contentListQuery` and the search schemas
adopted the stricter, casing-preserving `localeCode`. Reusing `localeCode`
here tightens BCP-47 validation and keeps locale handling consistent across
the API: a malformed `?locale=` value is now rejected instead of silently
matching zero rows. Addresses non-blocking review feedback on #1572.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(core): backfill locale casing on ec_* tables (#1572)
Addresses review feedback on #1572: removing localeCode's lowercasing
transform fixed new locale-filtered queries against the canonical
casing, but pre-existing rows already stored under the lowercased form
(e.g. zh-tw) were still missed by an exact locale = 'zh-TW' filter.
Adds migration 044, which canonicalizes the locale column on every
ec_* table against getI18nConfig().locales, case-insensitively. No-op
when i18n isn't configured. Not reversible (down is a no-op) -- the
original incorrect casing isn't recoverable and re-lowercasing would
reintroduce the bug.
Updates the "partially applied" migration-runner test to include the
new trailing migration.
* fix(core): keep locale taxonomy pivots in sync
* chore(core): clarify locale casing comments
* fix(core): repair locale casing from runtime config
* fix(core): canonicalize localized API writes
* fix(core): canonicalize taxonomy locale filters
* fix(core): canonicalize search locale filters
---------
Co-authored-by: Marcus (bug-testing) <marcusbellamyshaw@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Fixes locale-filtered content and search results for locales with uppercase region or script subtags. Existing content rows saved with lowercased locale values are repaired automatically.
0 commit comments