Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: proxy to source registry when package is public scoped with enco…
Browse files Browse the repository at this point in the history
…ded path (#1415)
  • Loading branch information
albertZhang2013 authored and fengmk2 committed Dec 1, 2018
1 parent 8bd0a2d commit 9bdb695
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion middleware/proxy_to_npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions test/middleware/proxy_to_npm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 9bdb695

Please sign in to comment.