Commit 9bc172fc9883a9eb2fa1ceee027cc37daadcc6e6
Handle bad mention names
cel committed on 1/20/2018, 12:35:56 AMParent: 14251d504418198fd278622cc498a5aff135d7d9
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -224,8 +224,9 @@ | ||
224 | 224 | function packageLinks(sbot, feed, id, name, spec) { |
225 | 225 | function matches(mention) { |
226 | 226 | var data = mention |
227 | 227 | && mention.link === id |
228 | + && mention.name | |
228 | 229 | && decodeName(mention.name) |
229 | 230 | return data |
230 | 231 | && data.name === name |
231 | 232 | && (spec ? semver.satisfies(data.version, spec) : true) |
@@ -636,9 +637,9 @@ | ||
636 | 637 | this.respond(this.req.method === 'PUT' ? 201 : 200, {token: '1'}) |
637 | 638 | } |
638 | 639 | |
639 | 640 | function decodeName(name) { |
640 | - var parts = name.replace(/\.tgz$/, '').split(':') | |
641 | + var parts = String(name).replace(/\.tgz$/, '').split(':') | |
641 | 642 | return { |
642 | 643 | name: parts[1], |
643 | 644 | version: parts[2], |
644 | 645 | distTag: parts[3], |
Built with git-ssb-web