From 8b40c6fc8bb1fcd9f453cd839dc72b572d41a873 Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Thu, 9 Apr 2015 21:20:10 +0200 Subject: [PATCH 1/4] Add https support to getSignedUrl function --- lib/storage/file.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/storage/file.js b/lib/storage/file.js index c9389e10f5f..191764bbbd6 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -786,8 +786,14 @@ File.prototype.getSignedUrl = function(options, callback) { ].join('\n')); var signature = sign.sign(credentials.private_key, 'base64'); + var base = 'http://storage.googleapis.com'; + + if (options.https) { + base = 'https://storage.googleapis.com' + } + callback(null, [ - 'http://storage.googleapis.com' + options.resource, + base + options.resource, '?GoogleAccessId=' + credentials.client_email, '&Expires=' + options.expires, '&Signature=' + encodeURIComponent(signature) From 9a771a489424131580f5ec91328c7130cf7ea9b3 Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Thu, 9 Apr 2015 21:42:25 +0200 Subject: [PATCH 2/4] Update CONTRIBUTORS --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9f2214f8a9f..81da8c5190d 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -13,6 +13,7 @@ Burcu Dogan Johan Euphrosine +Marco Ziccardi Patrick Costello Silvano Luciani Stephen Sawchuk From b6b8f5a2031ae4dd986f85d892e1328b9ccd80ea Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Thu, 9 Apr 2015 23:11:40 +0200 Subject: [PATCH 3/4] Fixed missing semicolon --- lib/storage/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/storage/file.js b/lib/storage/file.js index 191764bbbd6..269e33a03fe 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -789,7 +789,7 @@ File.prototype.getSignedUrl = function(options, callback) { var base = 'http://storage.googleapis.com'; if (options.https) { - base = 'https://storage.googleapis.com' + base = 'https://storage.googleapis.com'; } callback(null, [ From f455ccefef4e628f8bb51c14d18a41d6d6f75dbb Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Tue, 14 Apr 2015 12:32:33 +0200 Subject: [PATCH 4/4] getSignedUrl always uses https --- lib/storage/file.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/storage/file.js b/lib/storage/file.js index 269e33a03fe..c5d7ca3407c 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -786,14 +786,8 @@ File.prototype.getSignedUrl = function(options, callback) { ].join('\n')); var signature = sign.sign(credentials.private_key, 'base64'); - var base = 'http://storage.googleapis.com'; - - if (options.https) { - base = 'https://storage.googleapis.com'; - } - callback(null, [ - base + options.resource, + 'https://storage.googleapis.com' + options.resource, '?GoogleAccessId=' + credentials.client_email, '&Expires=' + options.expires, '&Signature=' + encodeURIComponent(signature)