From 21f7f03cf7011365ccd26a4806e644632affdcb9 Mon Sep 17 00:00:00 2001 From: Joseph Gentle Date: Thu, 15 May 2014 16:07:33 -0700 Subject: [PATCH 1/2] Fixed sinopia to allow old tarballs with @ in them --- lib/utils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 485a75cb..6488f21a 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -10,8 +10,7 @@ module.exports.validate_name = function(name) { if ( name.charAt(0) === '.' || // ".bin", etc. name.charAt(0) === '-' || // "-" is reserved by couchdb - name.match(/[\/@\s\+%:]/) || - name !== encodeURIComponent(name) || + name.match(/[\/\s\+%:]/) || name === 'node_modules' || name === '__proto__' || name === 'package.json' || From 68bf469ad4da2d3071177fe77b4d9275971a8e89 Mon Sep 17 00:00:00 2001 From: Joseph Gentle Date: Thu, 15 May 2014 16:17:48 -0700 Subject: [PATCH 2/2] Fixed unit tests --- lib/utils.js | 2 +- test/unit/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 6488f21a..2b433185 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -10,7 +10,7 @@ module.exports.validate_name = function(name) { if ( name.charAt(0) === '.' || // ".bin", etc. name.charAt(0) === '-' || // "-" is reserved by couchdb - name.match(/[\/\s\+%:]/) || + name.match(/[\\\/\s\+%:]/) || name === 'node_modules' || name === '__proto__' || name === 'package.json' || diff --git a/test/unit/utils.js b/test/unit/utils.js index e69d8db3..bf407d06 100644 --- a/test/unit/utils.js +++ b/test/unit/utils.js @@ -5,6 +5,7 @@ describe('Validate', function() { it('good ones', function() { assert(validate('sinopia')) assert(validate('some.weird.package-zzz')) + assert(validate('old-package@0.1.2.tgz')) }) it('uppercase', function() { @@ -32,7 +33,6 @@ describe('Validate', function() { }) it('other', function() { - assert(!validate('pkg@')) assert(!validate('pk g')) assert(!validate('pk\tg')) assert(!validate('pk%20g'))