npm-registry-client
Advanced tools
Comparing version 0.2.16 to 0.2.17
@@ -75,19 +75,20 @@ | ||
function handle(er) { | ||
if (er.message.indexOf("conflict Document update conflict.") === 0) { | ||
return cb(conflictError.call(this, data._id)); | ||
} | ||
this.log.error("publish", "Error uploading package"); | ||
return cb(er) | ||
} | ||
var exists = fullData.versions && fullData.versions[data.version] | ||
if (exists) return cb(conflictError.call(this, data._id)) | ||
this.request("PUT", dataURI, data, function (er) { | ||
if (er) { | ||
if (er.message.indexOf("conflict Document update conflict.") === 0) { | ||
return cb(conflictError.call(this, data._id)) | ||
} | ||
this.log.error("publish", "Error sending version data") | ||
var rev = fullData._rev; | ||
attach.call(this, data.name, tarball, tbName, rev, function (er) { | ||
if (er) return handle(er) | ||
this.log.verbose("publish", "attached", [data.name, tarball, tbName]) | ||
this.request("PUT", dataURI, data, function (er) { | ||
if (er) return handle(er) | ||
return cb(er) | ||
} | ||
this.log.verbose("publish", "attach 2", [data.name, tarball, tbName]) | ||
attach.call(this, data.name, tarball, tbName, function (er) { | ||
this.log.verbose("publish", "attach 3" | ||
,[er, data.name]) | ||
return cb(er) | ||
}.bind(this)) | ||
@@ -106,13 +107,8 @@ }.bind(this)) | ||
function attach (doc, file, filename, cb) { | ||
function attach (doc, file, filename, rev, cb) { | ||
doc = encodeURIComponent(doc) | ||
this.request("GET", doc, function (er, d) { | ||
if (er) return cb(er) | ||
if (!d) return cb(new Error( | ||
"Attempting to upload to invalid doc "+doc)) | ||
var rev = "-rev/"+d._rev | ||
, attURI = doc + "/-/" + encodeURIComponent(filename) + "/" + rev | ||
this.log.verbose("uploading", [attURI, file]) | ||
this.upload(attURI, file, cb) | ||
}.bind(this)) | ||
var revu = "-rev/"+rev | ||
, attURI = doc + "/-/" + encodeURIComponent(filename) + "/" + revu | ||
this.log.verbose("uploading", [attURI, file]) | ||
this.upload(attURI, file, cb) | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "Client for the npm registry", | ||
"version": "0.2.16", | ||
"version": "0.2.17", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "git://github.com/isaacs/npm-registry-client" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68296
1049