Skip to content

Commit

Permalink
Set correct metadata when uploading gzipped files (#3)
Browse files Browse the repository at this point in the history
* x up to last google cloud version

* x support for gzipped files, was missing contentEncoding
  • Loading branch information
olivierchatry authored and Ilya Radchenko committed Aug 24, 2016
1 parent c2577d2 commit ba18e46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions libs/upload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var path = require('path');
var gcloud = require('gcloud');
var gcloud = require('google-cloud');
var Promise = require('ember-cli/lib/ext/promise');


module.exports = function uploadToGCS(plugin, config) {
var cloud = gcloud(config.gcloud);
var gcs = cloud.storage();
Expand All @@ -13,9 +14,10 @@ module.exports = function uploadToGCS(plugin, config) {

return new Promise(function (resolve, reject) {
var destinationFilePath = config.bucketFolder ? path.join(config.bucketFolder, filePath) : filePath;

var metadata = isGzipped ? {contentEncoding:"gzip"} : {}
return bucket.upload(basePath, {
destination: destinationFilePath,
metadata:metadata,
gzip: !isGzipped
}, function (err, file) {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"dependencies": {
"ember-cli-babel": "^5.1.6",
"ember-cli-deploy-plugin": "^0.2.6",
"gcloud": "^0.30.3",
"google-cloud": "^0.38.3",
"minimatch": "^3.0.2"
},
"ember-addon": {
Expand Down

0 comments on commit ba18e46

Please sign in to comment.