parseword/improvur

failing an many cases

Opened this issue · 2 comments

example:
http://imgur.com/r/funny/5puzKbV

should redirect to:
http://i.imgur.com/5puzKbV.png

also not sure why you're adding a jpg extension - it should be easy enough to preserve the correct extension

Good catch, I'll look at handling links to "sub-imgurs" or whatever they call their /r/foo structure.

The .jpg extension hack is used because there's no way to discern from the original URL what the target file extension should be, i.e. nothing in http://imgur.com/r/funny/5puzKbV indicates PNG. It would be possible to issue a HEAD request for all links in the background and parse the Content-Type header, but I'm not sure I like that approach.

oh, i gotcha - i was mistakenly assuming you parsed the page source to
get the image url and obviously that's not the case

thanks

On 03/09/2016 01:23 PM, Shaun Cummiskey wrote:

Good catch, I'll look at handling links to "sub-imgurs" or whatever they call their /r/foo structure.

The .jpg extension hack is used because there's no way to discern from the original URL what the target file extension should be, i.e. nothing in http://imgur.com/r/funny/5puzKbV indicates PNG. It would be possible to issue a HEAD request for all links in the background and parse the Content-Type header, but I'm not sure I like that approach.


Reply to this email directly or view it on GitHub:
#2 (comment)