Skip to content
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

Text assets's content-type is always text/html #1218

Closed
kazuhikoarase opened this issue Nov 26, 2019 · 5 comments · Fixed by #1330
Closed

Text assets's content-type is always text/html #1218

kazuhikoarase opened this issue Nov 26, 2019 · 5 comments · Fixed by #1330

Comments

@kazuhikoarase
Copy link

kazuhikoarase commented Nov 26, 2019

Nature of issue?

  • Found a bug

Details about the bug:

  • Web browser and version: Chrome
  • Operating System: Windows
  • Steps to reproduce this bug:

I found getFileContent function at /p5.js-web-editor/server/controllers/file.controller.js
But there are nothing considered about content-type and rely on default behavior.

Express official document says

When the parameter is a Buffer object, the method sets the Content-Type response header field to “application/octet-stream”

When the parameter is a String, the method sets the Content-Type to “text/html”

https://expressjs.com/en/api.html#res.send

I think that it should be text/javascript(or application/javascript) for .js, application/json for .json and so on.

Thank you.

@catarak
Copy link
Member

catarak commented Dec 5, 2019

Thanks for reporting! This is definitely a bug, related to #496 but fixing this in a different place.

@ashu8912
Copy link
Contributor

Hey @catarak can you guide me where to start to fix this one.

@catarak
Copy link
Member

catarak commented Jan 28, 2020

You'll need to edit the function getFileContent to change the MIME type based on the file extension.

@ashu8912
Copy link
Contributor

ok sending in a pr soon

@sorcerix
Copy link

Is anyone working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants