Google photos images not downloaded

AI-generated summary

The issue of Google Photos images not being downloaded by Discourse has been discussed. pfaffman initially reported that Google image links are not recognized as images due to the lack of a file extension. sam suggested that this might not be specific to Google, but rather an issue with oneboxing in general.

After further discussion, vinothkannans confirmed that the issue is due to Google Photos not using file extensions in their image URLs. He initially suggested adding a special case for Google, but sam questioned why this is necessary and proposed downloading every <img src> tag regardless of the URL.

vinothkannans agreed and has since fixed the issue, allowing Discourse to download images from Google Photos and other sources without requiring a file extension. The fix has been committed to the Discourse and Onebox repositories.

It seems that Discourse doesn’t see that Google image links are images in order to know to download them locally.

I noticed this first on a multi-site instance, and then checked on try.

Here’s this url https://photos.app.goo.gl/KXa79xi3R82sjisX8 that renders beautifully into an image, but it never gets pulled down locally. I think it’s because the stupid Google doesn’t make those URLs end in .jpg the way God intended and there’s nothing that can be done, but I thought I’d ask anyway.

Google Photos

Interesting … what about flickr?

Imgur

I think this is not specific to google, its more of an all onebox thing, @techAPJ any idea why this is happening.

Also … behold my ninja hamster above, so cute, yet so dangerous.

Kind of a scope creep, let’s focus on other things for now. It’s been this way forever.

Yeah I remember this popping up before, I am just a bit surprised cause I thought @vinothkannans fixed this a while back.

https://meta.discourse.org/t/download-images-for-oneboxes-as-well-if-download-images-is-set/21103/30?u=sam

Oh aha maybe @vinothkannans can take a peek next week if he already worked on it before.

We already downloading onebox images. The issue here is “Google Photos” not using file extension in the image URLs. So we are unable to fetch it from the post content. Anyway we can achieve it by adding a special case for Google. Added to my list.

Why it’s not working :thinking:. It have valid image URL (https://c1.staticflickr.com/1/18/24130109_68f93566b9_m.jpg) inside onebox html.

Why do we need this though? Should we not just try to download everything that is <img src="https://site.com/i_must_be_an_image">, it will come back with a mime type.

Yes, good question. We should download everything in img src. I will investigate further :+1:

I’ve fixed it here.

https://github.com/discourse/discourse/commit/6aee22b88f61184c0fdf03c7fc16c4cfea4ed5cd

https://github.com/discourse/onebox/commit/ebb4b54548d51bb63923959a16f106f787f2ad48