Feature Request: please provide correct mime types for raw downloads #144037
Replies: 1 comment
-
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Product Feedback
Body
Right now, it is not possible to push a
.html
file to a repo, and have it link to external JavaScript or CSS because GitHub's raw download provides the wrong mime type for files. For example, look at this file:https://github.com/trusktr/trusktr/blob/main/index.html
The raw URL is:
https://raw.githubusercontent.com/trusktr/trusktr/refs/heads/main/index.html
But when you view it, it will not be rendered in a browser, because GitHub sends incorrect mime types (f.e. just text/plain).
A workaround is to use a 3rd-party proxy service:
https://raw.githack.com/
If you paste this URL,
https://github.com/trusktr/trusktr/blob/main/index.html
over in raw.githack, it will show you this URL for development:
https://raw.githack.com/trusktr/trusktr/main/index.html
It also gives you a permanent "production" URL for the specific commit:
https://rawcdn.githack.com/trusktr/trusktr/b99e372490a72521d858699cdc0500fadee2b1dd/index.html
When you visit either of those last two URLs, the page will render! This is because raw.githack intercepts the files and modifies the mime types so they are correct.
This is super useful because it means when pushing web code, all you have to do it is know the raw.githack URL format, and you can easily test web projects.
For example, for this example in a commit in the Lume project,
https://github.com/lume/lume/blob/64303f70d55a4f25198b0a3130afc50450eef8c0/examples/fbx-model.html
we can see the 3D example live by using the raw.githack URL format with the same commit:
https://rawcdn.githack.com/lume/lume/64303f70d55a4f25198b0a3130afc50450eef8c0/examples/fbx-model.html
This makes testing any pull request incredibly easy: simply open the examples with the raw.githack URL format!
It would be AMAZING if GitHub could provide the correct mime types directly. Publishing static web content would then be super easy: just push and then view the HTML files directly!
This would be simpler and easier than having to set up GitHub Pages for plain static content without any special features like templating that GitHub Pages offers.
For this to be backwards compatible, it might need a special new button aside from
Raw
, and a new URL format, for example the URL might look like this:https://static.githubusercontent.com/trusktr/trusktr/refs/heads/main/index.html
(with
static.
instead ofraw.
), or similar.Please allow this. Also, maybe even provide a toggle switch that can render HTML files in an iframe instead of showing the HTML code, when viewing HTML files in the file explorer.
This would be next level buildless vanilla web development, right from GitHub's UI!
Here's a video showing how to use raw.githack:
Screen.Recording.2024-11-08.at.8.02.01.PM.mov
Beta Was this translation helpful? Give feedback.
All reactions