23

This is an intermittent failure and I cannot find a good way to reliably reproduce it.

Some times when uploading an image in chat it shows up but the link leads to a page that says "oh no, that request didn't look right".

Here is an example of such a message - the image embeds and shows up, but clicking on it goes to https://i.sstatic.net/kEIRuMK.png and shows an error.

The exact steps1 I took were:

  1. Take a screenshot using the Greenshot software
  2. Then used the option in Greenshot option to upload to Imgur
  3. Then I opened the chat image uploader, switched to "from the web" and pasted the link for the Imgur image I got in step 2.

When I realised the link did not work, I used the exact same image (it was still open in Greenshot editor) and uploaded it through the main site, took the link, and posted it in chat: this is the resulting message (links to https://i.sstatic.net/Cbs8ZxZr.png) and it both embeds and the link shows the image.

Here is another message from a different user exhibiting the same problem - it embeds but the link is dead. The link to the image is https://i.sstatic.net/VgpSV1t.png This was uploaded using a chat extension but essentially used a local image (like how the "from my computer" option works) instead of using an image link from the web.

I cannot guarantee only images that go through the chat uploader experiences this problem. So far, I have only observed it in chat. Moreover, does not seem to happen consistently.


1 I am including the steps for completeness. I do not believe anything specifically in these steps triggers the behaviour.

11
  • 18
    Ohhhhh - I know what's happening. The actual image is https://i.sstatic.net/kEIRuMKb.png. Note that the filename is 8 characters long (new image service) and also note that it ends in a b. Chat tries to do this clever thing where if someone uploads an image thumbnail (with a trailing letter resize s,ml,b,t,h), it'll use the provided image in chat, but link to the full image (by stripping off the trailing resize char). In this case, because the random image id happened to end in b (thus why it randomly happens) chat removes it thinking it's linking to the full image.
    – KyleMit StaffMod
    Commented Jun 13 at 14:29
  • 4
    guess what, @KyleMit.. I mentioned this exact issue to JNat, days ago and in the end decided against posting this.. Now if you guys fix the bug I will have to ask them a bounty for the "missed out rep" :P (just joking) Commented Jun 13 at 14:44
  • 4
    @SPArcheon, you're looking at the all time bounty giver on SO right now. I'm sure we can work something out :)
    – KyleMit StaffMod
    Commented Jun 13 at 15:23
  • 2
    @KyleMit more seriously I had that happen on me twice so far, first time was a trailing 'b', second time an 'm'. So your explanation is pretty much confirmed. Commented Jun 13 at 16:07
  • 3
    @KyleMit so any chance to throw a status-planned on this? (i.e. you can confirm you're going to dig the code responsible for that behavior, and fix it?) Thanks! Commented Jun 13 at 21:23
  • 2
    I think I know who's responsible. Commented Jun 13 at 21:27
  • 3
    @KyleMit looks like Marc fixed this very related bug in September 1st, 2014 - maybe you can dig in the commits and see it, to save some time. Commented Jun 14 at 15:12
  • 3
    Thanks @ShadowWizard! The amount of digging on meta to find related posts will never cease to amaze me.
    – KyleMit StaffMod
    Commented Jun 14 at 15:28
  • 1
    @ShadowWizard Looking at this comment from Marc and the one immediately after it, it seems the prior bug was fixed by having the chat system query the image with the ending letter omitted, checking if that returns a 404, and if not, assuming it's correct to chop it off. However, the new image host instead returns a 400 error on all 6- and 7-character URLs instead of 404, which likely broke the code in chat that (probably) only checks for 404 errors. Commented Jun 14 at 18:56
  • 4
    @KyleMit See above comment. As far as I can tell, if the code in chat cannot be fixed, ensuring that the new image host properly returns 404 on nonexistent 6- and 7-character URLs will likely fix the bug and make the code in chat work again. (Plus it's the semantically right thing to do - 404 is the correct code.) Commented Jun 14 at 18:57
  • 1
    @Sonic well when it's 8 characters and missing, we do get 404. The 400 means "invalid argument" i.e. way to know such image can't even exist, so not sure it's the right thing to have it return 404 error message as the status code in this case has a meaning. Anyway, fixing the chat code itself should hopefully be doable, and a developer might do it one day. Commented Jun 15 at 18:01

1 Answer 1

6

This was inadvertently broken when we upgraded chat to use the new image service. Copying from my comment:

Ohhhhh - I know what's happening. The actual image is https://i.sstatic.net/kEIRuMKb.png. Note that the filename is 8 characters long (new image service) and also note that it ends in a b. Chat tries to do this clever thing where if someone uploads an image thumbnail (with a trailing letter resize s,ml,b,t,h), it'll use the provided image in chat, but link to the full image (by stripping off the trailing resize char). In this case, because the random image id happened to end in b (thus why it randomly happens) chat removes it thinking it's linking to the full image.

I updated the parsing in OneBoxes to be more specific about image lengths when looking for a trailing resize character:

- ^(https?://i\.sstatic\.net/)([^.]+?)(s|b|t|m|l|h)?(\..*)$
+ ^(https?://i\.sstatic\.net/)([^.]{5}|[^.]{8})(s|b|t|m|l|h)?(\..*)$

Caveat: I didn't go back in and re-bake the old one-boxes that had already parsed the message contents. Going forward, this will be fixed, but old messages you'll have to continue to workaround if you're trying to click on image links (Right click > Copy image address)

1
  • 1
    Can the image host also be fixed to return 404 errors on 7-character URLs instead of 400? Commented Jul 30 at 20:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .