Skip to content

Commit 4a2c490

Browse files
author
nicola
committed
decode uri component
1 parent 68dc12c commit 4a2c490

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎lib/utils.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var path = require('path');
1212
var S = require('string');
1313

1414
function uriToFilename(uri, base) {
15+
console.log(uri)
16+
uri = decodeURIComponent(uri)
1517
var filename = path.join(base, uri);
1618
// Make sure filename ends with '/' if filename exists and is a directory.
1719
// TODO this sync operation can be avoided and can be left

‎test/utils.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@ describe('Utility functions', function() {
2020
it('should return empty as relative path for undefined path', function() {
2121
assert.equal(utils.pathBasename(undefined), '');
2222
});
23+
24+
it('should properly decode a uri', function() {
25+
assert.equal(utils.uriToFilename('uri%20', 'base/'), 'base/uri ')
26+
});
2327
});
2428
});

0 commit comments

Comments
 (0)