fix: encode project slugs in canonical URLs (#7208)

This commit is contained in:
ItsCapnMurica
2026-08-20 17:51:47 +00:00
committed by GitHub
parent 6a92ab0c2c
commit 8eb12d5d24
@@ -62,7 +62,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
const remainder = pathParts.filter((x) => x).join('/') const remainder = pathParts.filter((x) => x).join('/')
// Build the canonical path // Build the canonical path
const canonicalPath = `/${correctType}/${project.slug}${remainder ? `/${remainder}` : ''}` const canonicalPath = `/${correctType}/${encodeURIComponent(project.slug)}${remainder ? `/${remainder}` : ''}`
// Only redirect if the path actually changed // Only redirect if the path actually changed
if (to.path !== canonicalPath) { if (to.path !== canonicalPath) {