mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
fix: encode project slugs in canonical URLs (#7208)
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user