25

Looking at the new users tab there are several users that get served a blank profile picture.

Upon inspection the profile pictures link to a Error 400 page from Google.

When the URL is slightly adapted (Exclude =s96-c=k-s328 ) the image is served.

The last part of this url is dynamic, as other values are also noticed instead of the 328.

Credit mostly goes to Shadow.

Digging into it, it's possible to request different size, but only one at a time:

6
  • This feels like a dupe of What can we do with broken avatars generated by Google? Oct 29 '20 at 14:41
  • 2
    @MetaAndrewT. it definetly is related. But there a 404 was returned, here a 400 error.
    – Luuklag
    Oct 29 '20 at 14:54
  • @Meta the other bug is result of users changing their Google profile picture, so little SE can do. This one here is purely on SE side. Oct 29 '20 at 20:27
  • 1
    Cross-site dupe on MSO: Google user avatars are broken for new users. Nov 17 '20 at 6:06
  • Ah man I was wondering what was happening. This has been bugging me for weeks. Based on the 400 response I thought Chrome had an HTTP 3 bug!! Dec 18 '20 at 19:35
  • $('img').get().filter(img => new URL(img.src).host === 'lh3.googleusercontent.com').forEach(el => el.src = el.src.replace(/=\w\d+-\w=\w-\w\d+.*/, '')); should probably do it. It removes both 2 sizes from the URL. Feb 7 at 18:14
7
+200

This will be fixed in the next build.

Many (but not all) avatars that come from Google start with /a-/ followed by an alphanumeric sequence. You can then append their weird not-query-string query string to change the rendering behavior. We add =k-s{size} to disable animations and select the rendering size.

After years of not sending any parameters, Google started including =s96-c on the image URLs it sends us. We weren't prepared for this and ended up just concatenating our parameters on the end. The logic has been revised so we scrub off =[^/]+$ from the end of URLs before we add our own.

These URLs will continue to be a moving target, so I expect them to break in new and novel ways every few years.

15
  • 1
    I expect them to break in new and novel ways every few years. ... that is why we still have a job ;)
    – rene
    Feb 22 at 18:53
  • Thanks for the fix Brian, despite this not being on the roadmap ;)
    – Luuklag
    Feb 22 at 19:12
  • @Luuklag maybe Brian is a Rebel Dev... ;-) Feb 22 at 21:49
  • While at it... can you please take a look what went wrong here? Is this something on SE side, or only Facebook side? Feb 23 at 13:40
  • Everything's on the level. I'm on bug duty and hollered that I could fix it when it was brought up in Slack. Feb 23 at 15:55
  • 1
    @ShadowWizardisVaccinating That's gotta be on the Facebook side, it's the exact same URL format we're getting for other Facebook users. I'm guessing the user restricts who can see their profile picture. Maybe we could detect broken/unavailable images during signup but that's a bigger project. Feb 23 at 16:02
  • Another issue... the network profile avatars are still broken, e.g. this one. Any chance to fix it? Feb 24 at 10:32
  • 1
    @ShadowWizardisVaccinating SE.com (THANKFULLY) uses the same library code as the rest of the network here. I just built it out but it will take up to 24 hours for the fix to show because caching. Feb 24 at 17:14
  • @Brian huh, since when? I'm pretty sure devs kept saying it use different codebase. Anyway, thanks for fixing it in there too! Feb 25 at 7:05
  • @ShadowWizardisVaccinating the same library, not code base. And only there they match. Read carefull ;)
    – Luuklag
    Feb 25 at 8:52
  • @Luuklag you can now apply to become a dev for SE. :-D Feb 25 at 9:34
  • @ShadowWizardisVaccinating I don't know how much use they have for someone programming some hackish VBA ;)
    – Luuklag
    Feb 25 at 9:38
  • @BrianNickel umm... network profile still showing broken image. :/ Mar 1 at 7:11
  • @ShadowTheVaccinatedWizard I was wrong. The files do come across the network API (and the correct value comes from the parent site), but only when a sync is triggered, not when cache expires. The best approach would probably be a bulk update query, but stackexchange.com is a pretty low priority so I don't know when if ever that might happen. Apr 13 at 20:08
  • @Brian thanks, not trivial to hear a developer (or any person, to be honest ;)) admits mistake directly, lol. Anyway no worry, it's really no big deal. Cheers and go smash some bigger bugs! :D Apr 14 at 6:32
3

My userscript ReduceClutter checks if avatar images (on profile, posts, etc.) are broken and replaces them with a grey box:

screenshot

screenshot

This should work for images hosted anywhere including Google and Facebook.

1
  • 2
    Gray box isn't much better, and even worse in my opinion. It should be easy enough to fix the avatar, if you can change the URL of the avatar. Feb 7 at 16:45

You must log in to answer this question.

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