diff --git a/assets/js/misc/index.ts b/assets/js/misc/index.ts index 35a85fc8..d124b011 100644 --- a/assets/js/misc/index.ts +++ b/assets/js/misc/index.ts @@ -43,6 +43,11 @@ export function isLocalPath(link: string, base?: string): boolean { return (!url.host || rootDomain.host === url.host); } +export function sanitizeInternalPath(path: string): string { + const runtimeConfig = useRuntimeConfig(); + return path.replace(new RegExp(`^(\/(${runtimeConfig.public.locales.map((l) => l.code).join('|')})\/?){2,}(.*)$`, 'g'), '$1$2'); +} + /** * ナビゲーションObjectを合致する条件まで深掘り * @param obj ナビゲーションObject diff --git a/components/content/ProseA.vue b/components/content/ProseA.vue index 6d137e55..5c3a3775 100644 --- a/components/content/ProseA.vue +++ b/components/content/ProseA.vue @@ -1,6 +1,7 @@