about summary refs log tree commit diff
path: root/bskylink
diff options
context:
space:
mode:
authorJason Culverhouse <jason@mischievous.org>2025-03-28 16:50:16 -0700
committerGitHub <noreply@github.com>2025-03-28 16:50:16 -0700
commit036bbfbaf9476b5bb8f05b8e37b066040758d64d (patch)
treea0c2b0dd403758f849e5f65ba4916b60b6091e34 /bskylink
parent7c124a870585758336e8d274ff60d3973c324047 (diff)
downloadvoidsky-036bbfbaf9476b5bb8f05b8e37b066040758d64d.tar.zst
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`

```
<html><head><meta http-equiv="refresh" content="0; URL='https://surf.social/feed/surf/custom/01jpz5vyjwvw5yaa8bfkha5xn4'" /><style>:root { color-scheme: light dark; }</style></head></html>
```

After changes:

```
curl -s "http://localhost:3000/redirect?u=https%3A%2F%2Fsurf.social%2Ffeed%2Fsurf%252Fcustom%252F01jpz5vyjwvw5yaa8bfkha5xn4"
<html><head><meta http-equiv="refresh" content="0; URL='https://surf.social/feed/surf%2Fcustom%2F01jpz5vyjwvw5yaa8bfkha5xn4'" /><style>:root { color-scheme: light dark; }</style></head></html>
```
Diffstat (limited to 'bskylink')
-rw-r--r--bskylink/src/routes/redirect.ts1
1 files changed, 0 insertions, 1 deletions
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 {