]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix: keep path case
authorEduardo San Martin Morote <posva13@gmail.com>
Sat, 16 Aug 2025 15:00:15 +0000 (17:00 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Sat, 16 Aug 2025 15:00:15 +0000 (17:00 +0200)
packages/router/src/experimental/route-resolver/matchers/matcher-pattern.spec.ts
packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts

index 6381c13cda8296e637bab053f7331290972117b9..74a8c3f692ba03b88afb61451be396b9bd5e28c3 100644 (file)
@@ -41,6 +41,11 @@ describe('MatcherPatternPathStatic', () => {
       const pattern = new MatcherPatternPathStatic('/')
       expect(pattern.build()).toBe('/')
     })
+
+    it('preserves case', () => {
+      const pattern = new MatcherPatternPathStatic('/Team')
+      expect(pattern.build()).toBe('/Team')
+    })
   })
 })
 
index d16a51ae8120de4ce33e560e6a0e13be050ad33b..901d7509910ffb67ec975480fd6b2917f8151349 100644 (file)
@@ -63,13 +63,18 @@ export interface MatcherPatternPath<
 export class MatcherPatternPathStatic
   implements MatcherPatternPath<EmptyParams>
 {
-  private path: string
-  constructor(path: string) {
-    this.path = path.toLowerCase()
+  /**
+   * lowercase version of the path to match against.
+   * This is used to make the matching case insensitive.
+   */
+  private pathi: string
+
+  constructor(private path: string) {
+    this.pathi = path.toLowerCase()
   }
 
   match(path: string): EmptyParams {
-    if (path.toLowerCase() !== this.path) {
+    if (path.toLowerCase() !== this.pathi) {
       throw miss()
     }
     return {}