-
Notifications
You must be signed in to change notification settings - Fork 212
Image camo #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It might make sense to do a "quick" grep across all image tags currently rendered to look for some common domains. If the image is on imgur.com, it's already on a CDN. If it's a github link, it might be possible to rewrite the link to https://rawgit.com instead. |
This feels a little out of scope. From my understanding, the request is that given a link to an image hosted on an arbitrary domain, docs.rs should download a copy of that image and host it itself so that it doesn't break/is served from the same CDN as the rest of the content.
After this change we'd also store
which means that you could potentially overload the server just by publishing a list of the million most popular images. With that in mind, I don't think this is worth implementing. |
I think this is something that we should eventually do, as it improves the privacy of users visiting docs.rs. But it's pretty low priority. |
We don’t need to store images long-term. If we are just proxying and can integrate well with a CDN to do the caching for us then this seems feasible. |
From what I see this would involve rewriting the image-tags in the HTML, or hooking into rustdoc in how it generates the tags. Both would be (I think) subject to a edge case where custom JS could still generate image links that point somewhere else, which we could solve with using The proxy itself could probably be a simple proxy endpoint. Caching it would be tricky, since I assume these external images are often dynamically generated, and used to inject dynamic content into the static docs. The privacy improvement is IMO a valid reason to work on this. |
Just to add one more argument for this feature: linkrot. Be it Imgur removing old images, someone taking down their personal website, anything really. Links rot. It's a fact of the internet. And the only way for There's a related, open, but inactive, issue for rustdoc to include the images: rust-lang/rust#32104 For smaller images data URLs may also be an option? P.S. Can the title be changed to something more descriptive? I almost ignored this issue in search results. |
When an image is included in a README or a doc file, docs.rs links directly to it. It should do like GitHub does and do proxying and caching for it.
The text was updated successfully, but these errors were encountered: