From fbbac1465d20e5883531a10df08d0ac045a373fc Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Tue, 24 Nov 2015 19:48:57 -0500 Subject: [PATCH] storage: generations are returned as strings --- lib/storage/file.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/storage/file.js b/lib/storage/file.js index df6e60d57b7..e3bc507e986 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -114,11 +114,12 @@ function File(bucket, name, options) { value: name }); + var generation = parseInt(options.generation, 10); var requestQueryObject = {}; - if (is.number(options.generation)) { - requestQueryObject.generation = options.generation; - this.generation = options.generation; + if (!isNaN(generation)) { + requestQueryObject.generation = generation; + this.generation = generation; } var methods = { @@ -372,7 +373,7 @@ File.prototype.copy = function(destination, callback) { } var query = {}; - if (is.number(this.generation)) { + if (is.defined(this.generation)) { query.sourceGeneration = this.generation; } @@ -1464,7 +1465,7 @@ File.prototype.startSimpleUpload_ = function(dup, metadata) { }) }; - if (is.number(this.generation)) { + if (is.defined(this.generation)) { reqOpts.qs.ifGenerationMatch = this.generation; }