Skip to content

Commit

Permalink
Set the Content-Type of uploaded images (GoogleCloudPlatform#67)
Browse files Browse the repository at this point in the history
Gets the Content-Type from multer and sets it when uploading the
image..
  • Loading branch information
andreban authored and jmdobry committed Aug 31, 2016
1 parent b1e8214 commit 6ba7453
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion 3-binary-data/lib/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ function sendUploadToGCS (req, res, next) {

var gcsname = Date.now() + req.file.originalname;
var file = bucket.file(gcsname);
var stream = file.createWriteStream();

var stream = file.createWriteStream({
metadata: {
contentType: req.file.mimetype
}
});

stream.on('error', function (err) {
req.file.cloudStorageError = err;
Expand Down

0 comments on commit 6ba7453

Please sign in to comment.