Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1006 from B77Mills/adPostRedirect
Browse files Browse the repository at this point in the history
Add redirect handling of queryParams for mindful adverting post
  • Loading branch information
brandonbk authored Nov 6, 2024
2 parents 5076ea4 + 1c934ff commit c0231b8
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ module.exports = (app, {
// redirect path to story url if url does not match.
const storyURL = new URL(story.url);
if (storyURL.pathname !== path) {
res.redirect(301, storyURL.pathname);
// account for redirecting with all of the queryParams
const newUrl = req.query && Object.keys(req.query).length !== 0
? `${storyURL.pathname}?${new URLSearchParams(req.query).toString()}`
: storyURL.pathname;
res.redirect(301, newUrl);
return;
}

Expand Down

0 comments on commit c0231b8

Please sign in to comment.