Skip to content

Commit

Permalink
fix: enable URL redirection that resolves to a URL with @ (fix #1347)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Dec 11, 2023
1 parent 622d414 commit 469866a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vike/shared/route/resolveRedirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ function resolveRouteStringRedirect(urlSource: string, urlTarget: string, urlPat
}
urlResolved = urlResolved.replaceAll(key, val)
})
/* We comment this assertion in order allow URL /npm/@my-team/my-package with redirect /npm/* -> https://cdn.jsdelivr.net/npm/* (https://github.com/vikejs/vike/issues/1347)
if (!urlResolved.startsWith('mailto:')) {
assertUsage(!urlResolved.includes('@'), 'URL should not contain "@" unless it is a mailto link.')
}
*/
if (urlResolved === urlPathname) return null
assert(urlResolved.startsWith('/') || isUriWithProtocol(urlResolved))
return urlResolved
Expand Down

0 comments on commit 469866a

Please sign in to comment.