diff --git a/index.js b/index.js index d436910..7261a59 100644 --- a/index.js +++ b/index.js @@ -23,6 +23,7 @@ function regify(vurl) { function paramify(url) { try { url = decodeURI(url) } catch($) {} + try { url = decodeURIComponent(url) } catch($) {} function match (vurl) { diff --git a/test/paramify.js b/test/paramify.js index 1b2233b..bed22fd 100644 --- a/test/paramify.js +++ b/test/paramify.js @@ -49,4 +49,13 @@ test('regex fail to match', function (t) { match = paramify('/@username') t.assert(!match(/^\/(xprofile|@#(.*?))/)) -}) \ No newline at end of file +}) + +test('encoded paths', function(t) { + t.plan(3) + + var match = paramify('/@example%2ftest') + t.assert(match('/@:first/:second')) + t.equal(match.params.first, 'example') + t.equal(match.params.second, 'test') +})