Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/web/src/pages/RouteDefinitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ export const routes: RouteDefinition[] = [
getTitle: () => StaticTitlesAndDescriptions.UniswapTitle,
getDescription: () => StaticTitlesAndDescriptions.SwapDescription,
getElement: (args) => {
return args.browserRouterEnabled && args.hash ? <Navigate to={args.hash.replace('#', '')} replace /> : <Landing />
if (args.browserRouterEnabled && args.hash) {
const path = args.hash.replace('#', '')
// Only redirect to internal paths starting with a single '/' to prevent
// protocol-relative URLs (e.g. //example.org) from causing SecurityErrors.
if (path.startsWith('/') && !path.startsWith('//')) {
return <Navigate to={path} replace />
}
}
return <Landing />
},
}),
createRouteDefinition({
Expand Down