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

Get file extension based on content-type application/javascript #137

Merged
merged 5 commits into from
Sep 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion plugins/file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ module.exports = {
return Boom.unsupportedMediaType("Content-type not allowed");
}

const type = mimos.type(contentType);
let type = mimos.type(contentType);
// The mimos package doesn't store the extension for the content-type text/javascript
// because its marked as deprecated by IANA. Therefore we get the file extension based
// on the content-type application/javascript
if (contentType === "text/javascript") {
type = mimos.type("application/javascript");
}
const extension = type.extensions[0] || "";

// buffer the contents to hash and later upload to s3
Expand Down