File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -14,15 +14,16 @@ function encodeURLPath(path) {
14
14
return String ( path ) . split ( '/' ) . map ( encodeURL ) . join ( '/' ) ;
15
15
}
16
16
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;
18
19
var queryMatcher = / \? ( .+ ) / ;
19
20
20
21
var _compiledPatterns = { } ;
21
22
22
23
function compilePattern ( pattern ) {
23
24
if ( ! ( pattern in _compiledPatterns ) ) {
24
25
var paramNames = [ ] ;
25
- var source = pattern . replace ( paramMatcher , function ( match , paramName ) {
26
+ var source = pattern . replace ( paramCompileMatcher , function ( match , paramName ) {
26
27
if ( paramName ) {
27
28
paramNames . push ( paramName ) ;
28
29
return '([^/?#]+)' ;
@@ -82,7 +83,7 @@ var Path = {
82
83
83
84
var splatIndex = 0 ;
84
85
85
- return pattern . replace ( paramMatcher , function ( match , paramName ) {
86
+ return pattern . replace ( paramInjectMatcher , function ( match , paramName ) {
86
87
paramName = paramName || 'splat' ;
87
88
88
89
invariant (
Original file line number Diff line number Diff line change @@ -212,6 +212,12 @@ describe('Path.injectParams', function () {
212
212
} ) . toThrow ( Error ) ;
213
213
} ) ;
214
214
} ) ;
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
+ } ) ;
215
221
} ) ;
216
222
217
223
describe ( 'Path.extractQuery' , function ( ) {
You can’t perform that action at this time.
0 commit comments