-
Notifications
You must be signed in to change notification settings - Fork 110
fix: it should handle already encoded parts in the URL when redirecting #3293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { URL } from 'url'; | ||
| import { FastifyInstance } from 'fastify'; | ||
| import encodeurl from 'encodeurl'; | ||
| import { ArticlePost, Post } from '../entity'; | ||
| import { getDiscussionLink, notifyView } from '../common'; | ||
| import createOrGetConnection from '../db'; | ||
|
|
@@ -35,7 +36,7 @@ export default async function (fastify: FastifyInstance): Promise<void> { | |
| } | ||
| const url = new URL(post.url); | ||
| url.searchParams.append('ref', 'dailydev'); | ||
| const encodedUri = encodeURI(url.href); | ||
| const encodedUri = encodeurl(url.href); | ||
|
||
| if (req.isBot) { | ||
| return res.status(302).redirect(encodedUri); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.