fix: proxy to source registry when package is public scoped with encoded path (#1415)

This commit is contained in:
Albert Zhang
2018-12-01 14:55:35 +08:00
committed by fengmk2
parent 8bd0a2d491
commit 9bdb695375
2 changed files with 8 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ module.exports = function (options) {
return yield next;
}
var pathname = this.path;
var pathname = decodeURIComponent(this.path);
var isScoped = false;
var isPublichScoped = false;

View File

@@ -48,6 +48,13 @@ describe('test/middleware/proxy_to_npm.test.js', () => {
.expect('Location', config.sourceNpmRegistry + '/@jkroso/type')
.expect(302, done);
});
it('should proxy to source registry when package is public scoped with encoded path', done => {
request(registry)
.get('/@jkroso%2Ftype')
.expect('Location', config.sourceNpmRegistry + '/@jkroso%2Ftype')
.expect(302, done);
});
});
describe('dist-tags', () => {