From d350f357b2a74df828ec022e03754d59cc680848 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 10 Jan 2025 19:29:22 +0000 Subject: [PATCH] fix(@angular/build): correctly validate locales `subPath` The `subPath` validation function was not being called. (cherry picked from commit 81a83dfa316b5f904020078cadd3aab50fa049d9) --- packages/angular/build/src/utils/i18n-options.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/angular/build/src/utils/i18n-options.ts b/packages/angular/build/src/utils/i18n-options.ts index 2482729e7813..81d9bcc02a89 100644 --- a/packages/angular/build/src/utils/i18n-options.ts +++ b/packages/angular/build/src/utils/i18n-options.ts @@ -65,7 +65,7 @@ function ensureString(value: unknown, name: string): asserts value is string { } } -function ensureValidsubPath(value: unknown, name: string): asserts value is string { +function ensureValidSubPath(value: unknown, name: string): asserts value is string { ensureString(value, name); if (!/^[\w-]*$/.test(value)) { @@ -121,7 +121,7 @@ export function createI18nOptions( } if (metadata.sourceLocale.subPath !== undefined) { - ensureValidsubPath(metadata.sourceLocale.subPath, 'i18n.sourceLocale.subPath'); + ensureValidSubPath(metadata.sourceLocale.subPath, 'i18n.sourceLocale.subPath'); rawsubPath = metadata.sourceLocale.subPath; } @@ -166,7 +166,7 @@ export function createI18nOptions( } if ('subPath' in options) { - ensureString(options.subPath, `i18n.locales.${locale}.subPath`); + ensureValidSubPath(options.subPath, `i18n.locales.${locale}.subPath`); subPath = options.subPath; }