Skip to content

Commit 3c70036

Browse files
author
Andrei
committed
Merge pull request nodeSolidServer#163 from nicola/decodeURIComponent
decode uri component
2 parents 68dc12c + ea9808f commit 3c70036

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

lib/utils.js

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

1414
function uriToFilename(uri, base) {
15+
uri = decodeURIComponent(uri)
1516
var filename = path.join(base, uri);
1617
// Make sure filename ends with '/' if filename exists and is a directory.
1718
// 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)