From 598a72427e37a0bdadf9874e0c4e32fc94bb1a58 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:06:17 +0900 Subject: [PATCH] fix: change url check logic to case invariant --- templates/modern/src/helper.test.ts | 1 + templates/modern/src/helper.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/modern/src/helper.test.ts b/templates/modern/src/helper.test.ts index 8587bdc8dff..3e0a82f75c2 100644 --- a/templates/modern/src/helper.test.ts +++ b/templates/modern/src/helper.test.ts @@ -19,6 +19,7 @@ test('is same URL', () => { expect(isSameURL({ pathname: '/a/foo.html' }, { pathname: '/a/foo' })).toBeTruthy() expect(isSameURL({ pathname: '/a/foo/' }, { pathname: '/a/foo' })).toBeTruthy() expect(isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/foo' })).toBeTruthy() + expect(isSameURL({ pathname: '/a/index.html' }, { pathname: '/A/Index.html' })).toBeTruthy() expect(isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/bar' })).toBeFalsy() }) diff --git a/templates/modern/src/helper.ts b/templates/modern/src/helper.ts index 7600bd64ba9..d1175511e2c 100644 --- a/templates/modern/src/helper.ts +++ b/templates/modern/src/helper.ts @@ -89,5 +89,6 @@ export function isSameURL(a: { pathname: string }, b: { pathname: string }): boo .replace(/\/index\.html$/gi, '/') .replace(/\.html$/gi, '') .replace(/\/$/gi, '') + .toLowerCase() } }