From: Eduardo San Martin Morote Date: Mon, 18 Aug 2025 11:22:53 +0000 (+0200) Subject: fix: matcher X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc94123b6211c4e5c321fc638b2f31c4dba4fafe;p=thirdparty%2Fvuejs%2Frouter.git fix: matcher --- diff --git a/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts b/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts index e2dcacda..419418ce 100644 --- a/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts +++ b/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts @@ -211,9 +211,17 @@ export class MatcherPatternPathDynamic< paramOptions = this.params[paramName] value = (paramOptions.set || identityFn)(params[paramName]) - return Array.isArray(value) - ? value.map(encodeParam).join('/') - : encodeParam(value) + // param cannot be repeatable when in a sub segment + if (__DEV__ && paramOptions.repeat) { + warn( + `Param "${String(paramName)}" is repeatable, but used in a sub segment of the path: "${this.pathParts.join('')}". Repeated params can only be used as a full path segment: "/file/[ids]+/something-else". This will break in production.` + ) + return Array.isArray(value) + ? value.map(encodeParam).join('/') + : encodeParam(value) + } + + return encodeParam(value as string | null | undefined) }) .join('') }