Skip to content

Commit

Permalink
Merge pull request #137 from nzzdev/fix-type-extension
Browse files Browse the repository at this point in the history
Get file extension based on content-type application/javascript
  • Loading branch information
manuelroth authored Sep 12, 2018
2 parents aeda77c + e26d3f9 commit b969d91
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit b969d91

Please sign in to comment.