Skip to content

Commit

Permalink
[changed] '.' is no longer a path delimeter
Browse files Browse the repository at this point in the history
  • Loading branch information
cleercode authored and ryanflorence committed Jul 2, 2014
1 parent 7b17307 commit f474ab1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/helpers/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function compilePattern(pattern) {

var source = pattern.replace(paramMatcher, function (match, pathSegment) {
paramNames.push(getParamName(pathSegment));
return pathSegment === '*' ? '(.*?)' : '([^./?#]+)';
return pathSegment === '*' ? '(.*?)' : '([^/?#]+)';
});

compiled.matcher = new RegExp('^' + source + '$', 'i');
Expand Down
6 changes: 6 additions & 0 deletions specs/Path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ describe('Path.extractParams', function () {
expect(Path.extractParams(pattern, 'users/123')).toBe(null);
});
});

describe('and the path matches with a segment containing a .', function () {
it('returns an object with the params', function () {
expect(Path.extractParams(pattern, 'comments/foo.bar/edit')).toEqual({ id: 'foo.bar' });
});
});
});

describe('when a pattern has characters that have special URL encoding', function () {
Expand Down

0 comments on commit f474ab1

Please sign in to comment.