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; }