Skip to content

Commit

Permalink
fix(@angular/build): correctly validate locales subPath
Browse files Browse the repository at this point in the history
The `subPath` validation function was not being called.

(cherry picked from commit 81a83df)
  • Loading branch information
alan-agius4 committed Jan 10, 2025
1 parent 955acef commit d350f35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/angular/build/src/utils/i18n-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d350f35

Please sign in to comment.