@@ -103,15 +103,16 @@ module.exports = CoreObject.extend({
103103 } ,
104104
105105 _putObject : function ( filePath , options , filePaths ) {
106- var plugin = this . plugin ;
107- var cwd = options . cwd ;
108- var bucket = options . bucket ;
109- var prefix = options . prefix ;
110- var acl = options . acl ;
111- var gzippedFilePaths = options . gzippedFilePaths || [ ] ;
112- var cacheControl = options . cacheControl ;
113- var expires = options . expires ;
114- var serverSideEncryption = options . serverSideEncryption ;
106+ var plugin = this . plugin ;
107+ var cwd = options . cwd ;
108+ var bucket = options . bucket ;
109+ var prefix = options . prefix ;
110+ var acl = options . acl ;
111+ var gzippedFilePaths = options . gzippedFilePaths || [ ] ;
112+ var brotliCompressedFilePaths = options . brotliCompressedFilePaths || [ ] ;
113+ var cacheControl = options . cacheControl ;
114+ var expires = options . expires ;
115+ var serverSideEncryption = options . serverSideEncryption ;
115116
116117 mime . default_type = options . defaultMimeType || mime . lookup ( 'bin' ) ;
117118
@@ -121,9 +122,17 @@ module.exports = CoreObject.extend({
121122 var encoding = mime . charsets . lookup ( contentType ) ;
122123 var key = prefix === '' ? filePath : [ prefix , filePath ] . join ( '/' ) ;
123124 var isGzipped = gzippedFilePaths . indexOf ( filePath ) !== - 1 ;
125+ var isBrotliCompressed = brotliCompressedFilePaths . indexOf ( filePath ) !== - 1 ;
124126
125127 if ( isGzipped && path . extname ( basePath ) === '.gz' ) {
126- var basePathUncompressed = path . basename ( basePath , '.gz' ) ;
128+ var basePathUngzipped = path . basename ( basePath , '.gz' ) ;
129+ if ( filePaths && filePaths . indexOf ( basePathUngzipped ) !== - 1 ) {
130+ contentType = mime . lookup ( basePathUngzipped ) ;
131+ encoding = mime . charsets . lookup ( contentType ) ;
132+ }
133+ }
134+ if ( isBrotliCompressed ) {
135+ var basePathUncompressed = path . basename ( basePath , '.br' ) ;
127136 if ( filePaths && filePaths . indexOf ( basePathUncompressed ) !== - 1 ) {
128137 contentType = mime . lookup ( basePathUncompressed ) ;
129138 encoding = mime . charsets . lookup ( contentType ) ;
@@ -152,6 +161,9 @@ module.exports = CoreObject.extend({
152161 if ( isGzipped ) {
153162 params . ContentEncoding = 'gzip' ;
154163 }
164+ if ( isBrotliCompressed ) {
165+ params . ContentEncoding = 'br' ;
166+ }
155167
156168 return new RSVP . Promise ( function ( resolve , reject ) {
157169 this . _client . putObject ( params , function ( error ) {
0 commit comments