Skip to content

Commit

Permalink
move over replace
Browse files Browse the repository at this point in the history
  • Loading branch information
mruwnik committed Feb 4, 2024
1 parent 3f3b813 commit 3f04f66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/routes/$redirects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const loader = async ({request, params}: LoaderArgs) => {
try {
const {data: redirects} = await loadRedirects(request)
const to = params['*'] && redirects[params['*'].replace(/^\/+/, '')]
if (to) return redirect(to.replace(/^\/+/, '/'))
if (to) return redirect(to)
} catch (e) {
console.error(e)
}
Expand Down
2 changes: 1 addition & 1 deletion app/server-utils/stampy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export const loadRedirects = withCache('redirects', async (): Promise<Redirects>
.reduce(
(acc, {values}) => ({
...acc,
[extractText(values.From).replace(/^\/+/, '')]: extractText(values.To),
[extractText(values.From).replace(/^\/+/, '')]: extractText(values.To).replace(/^\/+/, '/'),
}),
{}
)
Expand Down

0 comments on commit 3f04f66

Please sign in to comment.