File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -80,9 +80,15 @@ module.exports = CoreObject.extend({
80
80
var basePath = path . join ( cwd , filePath ) ;
81
81
var data = fs . readFileSync ( basePath ) ;
82
82
var contentType = mime . lookup ( basePath ) ;
83
+ var encoding = mime . charsets . lookup ( contentType ) ;
83
84
var key = path . join ( prefix , filePath ) ;
84
85
var isGzipped = gzippedFilePaths . indexOf ( filePath ) !== - 1 ;
85
86
87
+ if ( encoding ) {
88
+ contentType += '; charset=' ;
89
+ contentType += encoding . toLowerCase ( ) ;
90
+ }
91
+
86
92
var params = {
87
93
Bucket : bucket ,
88
94
ACL : acl ,
Original file line number Diff line number Diff line change
1
+ body : {}
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ describe('s3', function() {
93
93
} ;
94
94
95
95
var options = {
96
- filePaths : [ 'app.js ' ] ,
96
+ filePaths : [ 'app.css ' ] ,
97
97
cwd : process . cwd ( ) + '/tests/fixtures/dist' ,
98
98
prefix : 'js-app' ,
99
99
bucket : 'some-bucket'
@@ -105,9 +105,9 @@ describe('s3', function() {
105
105
. then ( function ( ) {
106
106
assert . equal ( s3Params . Bucket , 'some-bucket' ) ;
107
107
assert . equal ( s3Params . ACL , 'public-read' ) ;
108
- assert . equal ( s3Params . Body . toString ( ) , 'some content here \n' ) ;
109
- assert . equal ( s3Params . ContentType , 'application/javascript ' ) ;
110
- assert . equal ( s3Params . Key , 'js-app/app.js ' ) ;
108
+ assert . equal ( s3Params . Body . toString ( ) , 'body: {} \n' ) ;
109
+ assert . equal ( s3Params . ContentType , 'text/css; charset=utf-8 ' ) ;
110
+ assert . equal ( s3Params . Key , 'js-app/app.css ' ) ;
111
111
assert . equal ( s3Params . CacheControl , 'max-age=63072000, public' ) ;
112
112
assert . deepEqual ( s3Params . Expires , new Date ( '2030' ) ) ;
113
113
} ) ;
You can’t perform that action at this time.
0 commit comments