anonymous_github icon indicating copy to clipboard operation
anonymous_github copied to clipboard

Anonymous Github not returning Content-Type header for Github pages (issue for ES6 modules in HTML spec)

Open Maximvdw opened this issue 2 years ago • 2 comments

Github pages that use module scripts like below:

<script type="module" src="./somefile.js"></script>

will not work on anonymous.4open.science. The reason for this is that no MIME type is reported for somefile.js which is required by the HTML5 specification.

To get modules to work correctly in a browser, you need to make sure that your server is serving them with a Content-Type header that contains a JavaScript MIME type such as text/javascript. If you don't, you'll get a strict MIME type checking error along the lines of "The server responded with a non-JavaScript MIME type" and the browser won't run your JavaScript.

Maximvdw avatar Apr 28 '22 09:04 Maximvdw

It should not be too difficult to handle. I will have a look in the future if you want to handle it. PRs are welcome. It should be added here: https://github.com/tdurieux/anonymous_github/blob/7c326143f5a2137ce73efff996d075527b878422/src/AnonymizedFile.ts#L193

tdurieux avatar Aug 09 '22 17:08 tdurieux

I don't succeed to reproduce it, the content type is correctly sent in the cases that I tested. Could you send me an example?

tdurieux avatar Aug 10 '22 06:08 tdurieux