Skip to content

Commit aff47f9

Browse files
committed
fix: add empty case for normalizePath
1 parent dd8be35 commit aff47f9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/i18n/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export function useTranslations(lang?: Lang) {
1919
}
2020

2121
function normalizePath(path: string): string {
22-
return path === '/' ? path : path.replace(/\/$/, '');
22+
if (path.length === 0) return '/';
23+
if (path === '/') return path;
24+
25+
return path.replace(/\/$/, '');
2326
}
2427

2528
export function isActive(linkPath: string, currentPath: string): boolean {

0 commit comments

Comments
 (0)