cnpm / cnpmjs.org

@@ -88,8 +88,10 @@
Loading
88 88
89 89
  // need limit by ip
90 90
  app.get(/^\/(@[\w\-\.]+\/[\w\-\.]+)\/download\/(@[\w\-\.]+\/[\w\-\.]+)$/, limit, downloadPackage);
91 +
  app.get(/^\/(@[\w\-\.]+\/[\w\-\.]+)\/download\/([\w\-\.]+)$/, limit, downloadPackage);
91 92
  app.get('/:name/download/:filename', limit, downloadPackage);
92 93
  app.get(/^\/(@[\w\-\.]+\/[\w\-\.]+)\/\-\/(@[\w\-\.]+\/[\w\-\.]+)$/, limit, downloadPackage);
94 +
  app.get(/^\/(@[\w\-\.]+\/[\w\-\.]+)\/\-\/([\w\-\.]+)$/, limit, downloadPackage);
93 95
  app.get('/:name/-/:filename', limit, downloadPackage);
94 96
95 97
  // delete tarball and remove one version

@@ -18,6 +18,14 @@
Loading
18 18
module.exports = function* download(next) {
19 19
  var name = this.params.name || this.params[0];
20 20
  var filename = this.params.filename || this.params[1];
21 +
  // scope pkg and download with out scope
22 +
  if (name.startsWith('@') && !filename.startsWith('@')) {
23 +
    var scope = name.slice(0, name.indexOf('/'));
24 +
    // fix filename with scope
25 +
    filename = `${scope}/${filename}`;
26 +
  }
27 +
28 +
21 29
  var version = filename.slice(name.length + 1, -4);
22 30
  // can not get dist
23 31
  var url = null;
Files Coverage
common 66.67%
controllers 85.44%
middleware 94.34%
models 90.42%
routes 100.00%
servers 90.91%
services 90.82%
sync 89.61%
config/index.js 75.51%
lib/common.js 89.19%
Project Totals (97 files) 87.32%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading