From 036bbfbaf9476b5bb8f05b8e37b066040758d64d Mon Sep 17 00:00:00 2001 From: Jason Culverhouse Date: Fri, 28 Mar 2025 16:50:16 -0700 Subject: Remove double decode of URI (#8068) At this point the URI is already decoded and decoding again will alter the uri ``` let link = req.query.u ``` example of a link that has `%` encoding... the initial redirect link is properly encoded. ``` curl -vv "https://go.bsky.app/redirect?u=https%3A%2F%2Fsurf.social%2Ffeed%2Fsurf%252Fcustom%252F01jpz5vyjwvw5yaa8bfkha5xn4" ``` The result is "double decoded", the proper link in this case should be `https://surf.social/feed/surf%2Fcustom%2F01jpz5vyjwvw5yaa8bfkha5xn4` ``` ``` After changes: ``` curl -s "http://localhost:3000/redirect?u=https%3A%2F%2Fsurf.social%2Ffeed%2Fsurf%252Fcustom%252F01jpz5vyjwvw5yaa8bfkha5xn4" ``` --- bskylink/src/routes/redirect.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'bskylink') diff --git a/bskylink/src/routes/redirect.ts b/bskylink/src/routes/redirect.ts index 519fe52a0..468d25019 100644 --- a/bskylink/src/routes/redirect.ts +++ b/bskylink/src/routes/redirect.ts @@ -21,7 +21,6 @@ export default function (ctx: AppContext, app: Express) { typeof link === 'string', 'express guarantees link query parameter is a string', ) - link = decodeURIComponent(link) let url: URL | undefined try { -- cgit 1.4.1