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

Malformed URLs for i.redd.it posts when using the reddit.com -> old.reddit.com website redirect #7873

Closed
F-Smith opened this issue Aug 13, 2023 · 2 comments · Fixed by #7895

Comments

@F-Smith
Copy link

F-Smith commented Aug 13, 2023

Description:

I recently noticed that when clicking on images in subreddits that are hosted on the i.redd.it domain, Brave loads up a random post on reddit.com/r/funny instead of the image I clicked on...

Upon closer inspection, I see that the post URL gets appended to this URL https://old.reddit.com/r/funny/comments/media/nice_hat/ as a query string.

For example, if you click on a post https://i.redd.it/05cnhtc5yo331.jpg it will incorrectly form the URL as: https://old.reddit.com/r/funny/comments/media/nice_hat/?url=https%3A%2F%2Fi.redd.it%2F05cnhtc5yo331.jpg

Steps to Reproduce

  1. Open the Brave iOS browser
  2. Enable the reddit.com -> old.reddit.com redirect (Settings -> Website Redirect)
  3. Go to a subreddit, e.g. https://old.reddit.com/r/AccidentalRenaissance/
  4. Select a post where after the post title, it says (i.redd.it)
  5. Click on either the image thumbnail or the post title.
  6. Observe how you end up on an entirely different URL of /r/funny/comments/media/nice_hat

Expected result:

  • I should see the image of the post I've clicked on.

Reproduces how often:

Easily reproduced whenever I click on a post with the (i.redd.it) domain after the post title

Brave Version:

Version v1.56 (23.8.4.21)

  • Can you reproduce this issue with the current build from AppStore? Yes

Device details:

iOS 16.5.1

Website problems only:

  • did you check with Brave Shields down? Yes, issue persists
  • did you check in Safari/Firefox (WkWebView-based browsers)? Yes, issue doesn't exist

Additional Information

  • Only seems to apply to image assets hosted on i.redd.it
  • Doesn't affect video assets hosted on v.redd.it
  • If you want to workaround this bug and still get to the post URL, you need to click on the number of comments next to the post instead of the post title or thumbnail.
@kylehickinson
Copy link
Collaborator

kylehickinson commented Aug 17, 2023

Looks like Reddit changed the way they load i.redd.it links… we'll have to see if there's a way to get around this without additional replacement logic

For investigation sake:

  • i.redd.it/{id} redirects to
  • reddit.com/media?url={iredditurl} which we rewrite as
  • old.reddit.com/media?url={iredditurl}

Unfortunately the final destination is not handled as a media lookup and instead is handled as a legacy post lookup, it just so happens that this "nice hat" post has a post ID of media

kylehickinson added a commit that referenced this issue Aug 17, 2023
`i.redd.it/{id}` now redirects to a new media viewer page instead of viewing the content directly, and that media page is located at `reddit.com/media?url={iredditurl}`. If we attempt to redirect this URL to `old.reddit.com`, it will be treated as a post lookup instead of the media viewer, and end up on a random /r/funny post from years ago
@kylehickinson kylehickinson added this to the 1.57 milestone Aug 17, 2023
@kylehickinson kylehickinson self-assigned this Aug 17, 2023
@hffvld
Copy link
Collaborator

hffvld commented Aug 21, 2023

Verified on iPhone 14 using version(s):

Device/OS: iPhone 14 [iOS 16.6]
Brave build: 1.57 (23.8.18.20)
BraveCore: 1.57.47 (116.0.5845.96)

Upgraded profile - PASS

STEPS:
Follow the steps from #7873 (comment)

ACTUAL RESULTS:

  • Verified that the proper picture is opened when reddit.com > old.reddit.com redirect is enabled

Reddit_.upgrade.mov
Fresh install - PASS

STEPS:
Follow the steps from #7873 (comment)

ACTUAL RESULTS:

  • Verified that the proper picture is opened when reddit.com > old.reddit.com redirect is enabled

Reddit_fresh.mov

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants