File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -14,15 +14,16 @@ function encodeURLPath(path) {
1414 return String ( path ) . split ( '/' ) . map ( encodeURL ) . join ( '/' ) ;
1515}
1616
17- var paramMatcher = / : ( [ a - z A - Z _ $ ] [ a - z A - Z 0 - 9 _ $ ] * ) | [ * . ( ) \[ \] \\ + | { } ^ $ ] / g;
17+ var paramCompileMatcher = / : ( [ a - z A - Z _ $ ] [ a - z A - Z 0 - 9 _ $ ] * ) | [ * . ( ) \[ \] \\ + | { } ^ $ ] / g;
18+ var paramInjectMatcher = / : ( [ a - z A - Z _ $ ] [ a - z A - Z 0 - 9 _ $ ] * ) | [ * ] / g;
1819var queryMatcher = / \? ( .+ ) / ;
1920
2021var _compiledPatterns = { } ;
2122
2223function compilePattern ( pattern ) {
2324 if ( ! ( pattern in _compiledPatterns ) ) {
2425 var paramNames = [ ] ;
25- var source = pattern . replace ( paramMatcher , function ( match , paramName ) {
26+ var source = pattern . replace ( paramCompileMatcher , function ( match , paramName ) {
2627 if ( paramName ) {
2728 paramNames . push ( paramName ) ;
2829 return '([^/?#]+)' ;
@@ -82,7 +83,7 @@ var Path = {
8283
8384 var splatIndex = 0 ;
8485
85- return pattern . replace ( paramMatcher , function ( match , paramName ) {
86+ return pattern . replace ( paramInjectMatcher , function ( match , paramName ) {
8687 paramName = paramName || 'splat' ;
8788
8889 invariant (
Original file line number Diff line number Diff line change @@ -212,6 +212,12 @@ describe('Path.injectParams', function () {
212212 } ) . toThrow ( Error ) ;
213213 } ) ;
214214 } ) ;
215+
216+ describe ( 'when a pattern has dots' , function ( ) {
217+ it ( 'returns the correct path' , function ( ) {
218+ expect ( Path . injectParams ( '/foo.bar.baz' ) ) . toEqual ( '/foo.bar.baz' ) ;
219+ } ) ;
220+ } ) ;
215221} ) ;
216222
217223describe ( 'Path.extractQuery' , function ( ) {
You can’t perform that action at this time.
0 commit comments