Skip to content

Commit 2ff60a7

Browse files
authored
OG 生成を新しいeventのパスに合わせ修正 (#61)
1 parent c93599f commit 2ff60a7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/functions/[[path]].ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ async function fetchProjectData(eventId: string, apiEndpoint: string): Promise<P
7676

7777
// eventId が有効かチェック(21文字のnanoid)
7878
function isValidEventId(path: string): boolean {
79-
// パスが /eventId の形式で、eventId が21文字の英数字・ハイフン・アンダースコア
80-
const match = path.match(/^\/([A-Za-z0-9_-]{21})$/);
79+
// 新パス /e/eventId または 旧パス /eventId の形式で、eventId が21文字の英数字・ハイフン・アンダースコア
80+
const match = path.match(/^\/(?:e\/)?([A-Za-z0-9_-]{21})$/);
8181
return !!match;
8282
}
8383

8484
// パスから eventId を抽出
8585
function extractEventId(path: string): string | null {
86-
const match = path.match(/^\/([A-Za-z0-9_-]{21})$/);
86+
// 新パス /e/eventId または 旧パス /eventId から eventId を抽出
87+
const match = path.match(/^\/(?:e\/)?([A-Za-z0-9_-]{21})$/);
8788
return match ? match[1] : null;
8889
}
8990

0 commit comments

Comments
 (0)