Skip to content

Commit

Permalink
Merge pull request #32 from jpmckinney/pr31
Browse files Browse the repository at this point in the history
Update mime lookup and extension methods for v2
  • Loading branch information
jpmckinney committed Jul 12, 2018
2 parents 24627d3 + 58b3f61 commit 7376937
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
# express 3.0 was released late 2012
# gm 1.2.0 added extent and gravity
# mime 1.1.0 added extension
- MODULES="express@~3 gm@1.2.0 mime@1.1.0"
- MODULES="express@~3 gm@1.2.0 mime@2.0.5"
- MODULES=""
install:
- npm install $MODULES
Expand Down
4 changes: 2 additions & 2 deletions lib/image-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ module.exports = function () {
// @see http://nodejs.org/api/http.html#http_request_headers
var mimeType;
if (extension) {
mimeType = mime.lookup(extension);
mimeType = mime.getType(extension);
}
else {
mimeType = (response.headers['content-type'] || '').replace(/;.*/, '');
extension = mime.extension(mimeType);
extension = mime.getExtension(mimeType);
}
if (mimeTypes.indexOf(mimeType) === -1) {
return res.status(404).send('Expected content type ' + mimeTypes.join(', ') + ', got ' + mimeType);
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"name": "image-proxy",
"version": "0.0.7",
"description": "A simple image proxy optimized for headshots",
"keywords": ["image", "proxy"],
"keywords": [
"image",
"proxy"
],
"homepage": "https://github.com/jpmckinney/image-proxy",
"bugs": "https://github.com/jpmckinney/image-proxy/issues",
"license": "MIT",
Expand All @@ -20,7 +23,7 @@
"dependencies": {
"express": ">=3",
"gm": ">=1.2.0",
"mime": ">=1.1.0"
"mime": ">=2.0.5"
},
"devDependencies": {
"coveralls": "~2.11",
Expand Down

0 comments on commit 7376937

Please sign in to comment.