From ba5fb1f41f3f7a1c72badf9d908e36db365abce5 Mon Sep 17 00:00:00 2001 From: Radek Pazdera Date: Thu, 21 Sep 2017 10:45:10 +0100 Subject: [PATCH] Autodetect a correct mime-type when deploying --- lib/deploy-methods/s3.js | 6 ++++-- package.json | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/deploy-methods/s3.js b/lib/deploy-methods/s3.js index 5aec1f3..6c5de81 100644 --- a/lib/deploy-methods/s3.js +++ b/lib/deploy-methods/s3.js @@ -2,7 +2,8 @@ const aws = require('aws-sdk'), TarGz = require('tar.gz'), stream = require('stream'), config = require('../config'), - Release = require('../data').Release; + Release = require('../data').Release, + mime = require('mime-types'); function _doRelease(build, target) { @@ -37,7 +38,8 @@ function _doRelease(build, target) { Key: entry.path, Body: p, ACL: 'public-read', - CacheControl: 'max-age=600' + CacheControl: 'max-age=600', + ContentType: mime.lookup(entry.path) || 'application/octet-stream' }, (err, data) => { if (err) { diff --git a/package.json b/package.json index 7c4f239..5fa6a84 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "colors": "^1.1.2", "git-rev-sync": "^1.9.1", "inquirer": "^3.2.3", + "mime-types": "^2.1.17", "semver": "^5.4.1", "tar.gz": "^1.0.5", "yargs": "^8.0.2"