Skip to content

Commit

Permalink
Merge pull request #961 from stephenplusplus/spp--storage-file-genera…
Browse files Browse the repository at this point in the history
…tions-can-be-strings

storage: generations are returned as strings
  • Loading branch information
callmehiphop committed Nov 25, 2015
2 parents 9681a03 + fbbac14 commit 9d676fc
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 9d676fc

Please sign in to comment.