bin/s3sync in cprobert-s3sync-1.4.1 vs bin/s3sync in cprobert-s3sync-1.4.2
- old
+ new
@@ -508,15 +508,25 @@
debug(@path)
headers = {'Content-Length' => (fromNode.size.respond_to?(:nonzero?) ? fromNode.size.to_s : '0')}
headers['x-amz-acl'] = 'public-read' if $S3syncOptions['--public-read']
headers['Expires'] = $S3syncOptions['--expires'] if $S3syncOptions['--expires']
headers['Cache-Control'] = $S3syncOptions['--cache-control'] if $S3syncOptions['--cache-control']
+
+
fType = @path.split('.').last
+
+ # is the file names myfile.gz.ext
+ if @path.split('.')[-2] == "gz"
+ headers['Content-Encoding'] = "gzip"
+ puts "Adding gzip header to #{@path}"
+ end
+ # is the file names myfile.ext.gz
if ($S3syncOptions['--gzip'] || "gz").split(",").include? fType
headers['Content-Encoding'] = "gzip"
fType = @path.split('.')[-2]
end
debug("File extension: #{fType}")
+
if defined?($mimeTypes) and fType != '' and (mType = $mimeTypes[fType]) and mType != ''
debug("Mime type: #{mType}")
headers['Content-Type'] = mType
end
@result = S3sync.S3try(:put, @bucket, @path, s3o, headers)