Skip to content

Commit

Permalink
storage: generations are returned as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Nov 25, 2015
1 parent 9681a03 commit fbbac14
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/storage/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit fbbac14

Please sign in to comment.