Browse Source

fix logic

Yuki Takei 1 year ago
parent
commit
64c5e5335a
1 changed files with 4 additions and 0 deletions
  1. 4 0
      packages/core/src/utils/path-utils.ts

+ 4 - 0
packages/core/src/utils/path-utils.ts

@@ -4,11 +4,15 @@ function matchSlashes(path: string): RegExpMatchArray | null {
 }
 
 export function hasHeadingSlash(path: string): boolean {
+  if (path === '/') return true;
+
   const match = matchSlashes(path);
   return (match?.[2] != null);
 }
 
 export function hasTrailingSlash(path: string): boolean {
+  if (path === '/') return true;
+
   const match = matchSlashes(path);
   return (match?.[4] != null);
 }