git ssb

3+

cel / ssb-npm-registry



Commit 58de1d615660eb5d4c847daa1b86913adec2c4b1

Fix bugs

cel committed on 10/11/2017, 7:06:03 PM
Parent: 1c34dbba0a5af77002cfc4b22f75b89616bc991a

Files changed

index.jschanged
index.jsView
@@ -471,9 +471,9 @@
471471 }, function (err) {
472472 if (err) return self.respondError(500, err.stack || err)
473473 if (spec) resolveSpec()
474474 else if (self.isNpm3 || self.isYarn) resolveAll()
475- else self.respond(200, obj)
475+ else done()
476476 })
477477 )
478478 function resolveSpec() {
479479 var version = obj['dist-tags'][spec]
@@ -481,24 +481,28 @@
481481 obj = obj.versions[version]
482482 if (!obj) return self.respondError(404, 'version not found: ' + spec)
483483 self.populatePackageJson(obj, function (err, pkg) {
484484 if (err) return self.respondError(500, err.stack || err)
485- self.respond(200, pkg || obj)
485+ obj = pkg || obj
486+ done()
486487 })
487488 }
488489 function resolveAll() {
489- // return self.respond(200, obj)
490490 var waiting = 0
491491 for (var version in obj.versions) (function (version) {
492492 waiting++
493493 self.populatePackageJson(obj.versions[version], function (err, pkg) {
494494 if (err && waiting <= 0) return console.trace(err)
495495 if (err) return waiting = 0, self.respondError(500, err.stack || err)
496496 if (pkg) obj.versions[version] = pkg
497- if (!--waiting) self.respond(200, obj)
497+ if (!--waiting) done()
498498 })
499499 }(version))
500+ if (!waiting) done()
500501 }
502+ function done() {
503+ self.respond(200, obj)
504+ }
501505 }
502506
503507 Req.prototype.servePrebuild = function (name) {
504508 var self = this
@@ -686,9 +690,9 @@
686690 cb(null, pkg)
687691 })
688692 pull(
689693 readBlob,
690- hash('sha256', 'hex', function (err, sum) {
694+ hash('sha1', 'hex', function (err, sum) {
691695 if (err) return cb(err)
692696 shasum = sum
693697 }),
694698 toPull(zlib.createGunzip()),

Built with git-ssb-web