tom-james-watson/old-reddit-redirect

Bad redirects on preview.redd.it or i.redd.it

NickTheHalfling opened this issue ยท 25 comments

Hi, idk what a github is but I wanted to file a bug report and hope this is the right place.
I hope someone else is having this issue because it will be very silly if they aren't.
Whenever I try to open an image on reddit, whether through a gallery or if it is a standalone photo, it sends me to this particular comment in an 11 year old thread from /r/funny.

The URL in question: https://old.reddit.com/r/funny/comments/media/nice_hat/?url=https%3A%2F%2Fpreview.redd.it%2Ffpmh0bz0xrgb1.jpg%3Fwidth%3D1080%26format%3Dpjpg%26auto%3Dwebp%26s%3Df9317b566782c4502923235198c52a6651529993

You can see that the image URL is there... It just insists on making me read this old comment? I don't know. It stops when I disable the plugin, but then I have to slog through new reddit and would rather have birds peck my eyeballs out. Help me if you can, if not I guess I'll cope

I'm having the same problem, it started several days ago, redirecting to the same post from r/funny. It doesn't happen always, but randomly, for example in this post. According to this, it happens only in Firefox.

Umm that is very strange. When I load https://old.reddit.com/r/MapPorn/comments/15ld9xz/endings_of_places_in_poland/ and click on the image I get taken to https://i.redd.it/8u1yl4kmwugb1.jpg as expected.

I've never seen this. Honestly it sounds like it's most likely an issue on reddit's end.

What exactly are the reproduction steps? What are you clicking on? The expanded image at the top of the comments page?

Can you please right click the image and press "copy link" and paste it here? For the above link it should be https://i.redd.it/8u1yl4kmwugb1.jpg, for example.

I've had the same issue recently. The /r/funny post has the shortlink of https://redd.it/media.

For the above link it should be https://i.redd.it/8u1yl4kmwugb1.jpg, for example.

That link redirects to the post for me as well.

Edit: I reinstalled the extension and it works now. I was using 8 Jan version previously.

Can you please right click the image and press "copy link" and paste it here? For the above link it should be https://i.redd.it/8u1yl4kmwugb1.jpg, for example.

Here's the copied link location: https://preview.redd.it/8u1yl4kmwugb1.jpg?width=1024&auto=webp&s=2d9a56eda3ea4165620490085467f61e7adf5c85
It's definitely the url that leads to the image, but clicking on it sends me to the "nice hat" post as described in the reddit thread posted by atanvardo. To reproduce it, I simply click the expanded image (or post title if i am in the comments section). I've restarted firefox and my entire computer since then, neither have proved successful.
I'm not on the beta version of firefox either. I'll try re-installing the extension and will report back if it works o7

Edit: Reinstalling the addon worked. Very strange! Sorry for causing a hubbub, glad it's an easy fix though!

Hmm still not really sure what's going on because I can't recreate without the extension and with the extension (latest) I don't see it either.

Will close this out because it seems like as long as you have the latest version of the extension then it doesn't happen.

A user reported this issue on Firefox store and attached a video: https://imgur.com/xP95XAE

It looks like maybe Reddit have changed the link format for images and that's causing a bad redirect on their end. I will investigate more when at a computer.

I registered to report the same issue. Nearly all image links redirect to the same 'funny hat' post. Seems to be something that someone at reddit is doing on purpose.

The weird redirect is happening on reddit's side (obviously). If you disable the extension completely and load

https://old.reddit.com/media?url=anything

you will end up on

https://old.reddit.com/r/funny/comments/media/nice_hat/

I will investigate what leads to this media?url= path being loaded.

OK I've worked it out.

Sometimes, when you request https://i.redd.it/8u1yl4kmwugb1.jpg, Reddit will return a redirect to https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2F8u1yl4kmwugb1.jpg.

The extension is redirecting this to https://old.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2F8u1yl4kmwugb1.jpg

https://old.reddit.com/media?url=anything redirects to "nice hat", for some strange reason.

I will make a new release that avoids redirecting www.reddit.com/media..., which will fix this problem.

Version 1.7.2 has been published to both chrome and firefox and should address this issue. It can take a few days for the new versions to get through approval.

Thanks for bringing this to my attention, all!

The last thing I would add is that the redirect from https://i.redd.it/8u1yl4kmwugb1.jpg to https://www.reddit.com/media?url=... seems happen inconsistently. Might be A/B testing.

Unfortunately, with the URLs in the format of https://www.reddit.com/media?url= we don't seem to be able to apply our existing workaround (#79, #81) that ensures the raw image file loads. If this change is going to be rolled out on Reddit's side for all image links then we will be back to loading images in the crappy HTML wrapper that Old Reddit does natively.

https://old.reddit.com/media?url=anything redirects to "nice hat", for some strange reason.

Because the nice hat post happens to have the shortlink of "media", out of any random 5 letter sequence.

Ahh right, of course!

I know this issue is closed so I'll try to be brief. I just came across this issue from a different issue unrelated to this. But (!) I just wanted to say, thank you so very much for not only making this add-on, but also actively maintaining support for it. Truly happy to witness your level of commitment. Always difficult to see when some add-ons haven't seen an update in years.

I used New Reddit almost exclusively since it was introduced (sorry I came from the Digg migration so new felt more familiar), but within the last year I (re)discovered Old Reddit and now prefer it. Thanks to your add-on (and Reddit Comment Collapser add-on) I can browse Reddit exactly the way I like to. I don't know how long any of this will last, but let me just say I am grateful for the time spent.

If I do come across any future bugs, I will let you know! Thanks again for this, cheers!

For some reason when I disable the add-on then re-enable it, it works again without redirecting to the wrong URL. Firefox. But every time I restart my browser the add-on begins redirecting images to the same incorrect URL.

Unfortunately you just need to wait for 1.7.2 to reach the addon store.

morops commented

This issue was mystifying me. But now that it is figured out:

  1. thanks for the quick turn on a fix
  2. this is one of the funnier "bugs" I have seen in my life, and the root cause analysis tickles my brain in the perfect way

Is anyone still having the same issues even with the updates? I find that I have to manually deactivate the reactive the add on every single time I restart Firefox. When I restart the browser it refuses to redirect images to a standalone page and remains in the main site with a bordered image and a login button.

That's not that same issue, that's a result of Reddit serving the images via this new URL format and I don't think there's anything we can do - looks like it's out of our hands.

Just FYI, this behavior is (currently) controlled by the Accept: header on the request.

A typical browser request might have: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8

and that gets the redirect response.

However, if you send a request with no text/html and such in the Accept: type, it will give you the image directly.

Eg: Accept: image/avif,image/webp,*/*;q=0.8

So, if this extension has the ability to control the request headers, that would be one way to fix it.

Other extensions can do such things (eg: simple-modify-headers), so it should be possible, but I have no experience with such things.

What you describe is already what the extension does - https://github.com/tom-james-watson/old-reddit-redirect/blob/master/background.js#L53-L83.

However, this only works for URLs in the format https://i.redd.it/8u1yl4kmwugb1.jpg and doesn't work for the newly-introduced format of https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2F8u1yl4kmwugb1.jpg.

Ah, understood. And to be clear, I am not using this extension right now, but: couldn't it decode the media?url=... links, and redirect to the raw image that way?

It's reddit itself that sometimes decides to redirect https://i.redd.it/8u1yl4kmwugb1.jpg to https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2F8u1yl4kmwugb1.jpg, so unfortunately no.

Oh man. This is probably an unhelpful comment, but I was getting redirected to that "nice hat" 11 year old r/funny post linked in the OP. It's taken me weeks to figure out that i.reddit links cause the redirect. Drove me nuts, I thought I was going crazy, or accidentally saved that link somehow.

After figuring that out, I found via the following post that reinstalling this extension would fix it. Which it did (for now).