]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix: matcher
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 18 Aug 2025 11:22:53 +0000 (13:22 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 18 Aug 2025 11:22:53 +0000 (13:22 +0200)
packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts

index e2dcacda0472dd868bfa70bbc3763781ffae1b39..419418ce0edb17e5dee693254dddf4a526956022 100644 (file)
@@ -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('')
           }