Skip to content

Commit

Permalink
Merge pull request remix-run#774 from kentor/master
Browse files Browse the repository at this point in the history
[fixed] Double slash in href when parent route has optional trailing sla...
  • Loading branch information
ryanflorence committed Feb 6, 2015
2 parents 32d24a5 + 5bcf653 commit 19c7bd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/utils/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var qs = require('qs');

var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g;
var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g;
var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?/g;
var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?\/|\/\?/g;
var queryMatcher = /\?(.+)/;

var _compiledPatterns = {};
Expand Down
6 changes: 6 additions & 0 deletions modules/utils/__tests__/Path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ describe('Path.injectParams', function () {
expect(Path.injectParams('/foo.bar.baz')).toEqual('/foo.bar.baz');
});
});

describe('when a pattern has optional slashes', function () {
it('returns the correct path', function () {
expect(Path.injectParams('/foo/?/bar/?/baz/?')).toEqual('/foo/bar/baz/');
});
});
});

describe('Path.extractQuery', function () {
Expand Down

0 comments on commit 19c7bd7

Please sign in to comment.