File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ export class UrlMatcher {
160
160
const matchDetails = ( m : RegExpExecArray , isSearch : boolean ) => {
161
161
// IE[78] returns '' for unmatched groups instead of null
162
162
let id = m [ 2 ] || m [ 3 ] ;
163
- let regexp = isSearch ? m [ 4 ] : m [ 4 ] || ( m [ 1 ] === '*' ? '. *' : null ) ;
163
+ let regexp = isSearch ? m [ 4 ] : m [ 4 ] || ( m [ 1 ] === '*' ? '[\\s\\S] *' : null ) ;
164
164
165
165
const makeRegexpType = ( regexp ) => inherit ( paramTypes . type ( isSearch ? "query" : "path" ) , {
166
166
pattern : new RegExp ( regexp , this . config . caseInsensitive ? 'i' : undefined )
Original file line number Diff line number Diff line change @@ -112,6 +112,15 @@ describe("UrlMatcher", function () {
112
112
expect ( m . exec ( '/document/' , { } ) ) . toEqual ( { path : '' } ) ;
113
113
} ) ;
114
114
115
+ it ( "should capture catch-all parameters in multiline url" , function ( ) {
116
+ var m = $umf . compile ( '/document/*path' ) ;
117
+ expect ( m . exec ( '/document/a/b/c\r\n/d' , { } ) ) . toEqual ( { path : 'a/b/c\r\n/d' } ) ;
118
+ expect ( m . exec ( '/document/\r\na/b\r\n/c' , { } ) ) . toEqual ( { path : '\r\na/b\r\n/c' } ) ;
119
+ expect ( m . exec ( '/document/a/b\r\n\r\n/c' , { } ) ) . toEqual ( { path : 'a/b\r\n\r\n/c' } ) ;
120
+ expect ( m . exec ( '/document/a/\rb/c\n' , { } ) ) . toEqual ( { path : 'a/\rb/c\n' } ) ;
121
+ expect ( m . exec ( '/document/\r\n' , { } ) ) . toEqual ( { path : '\r\n' } ) ;
122
+ } ) ;
123
+
115
124
it ( "should use the optional regexp with curly brace placeholders" , function ( ) {
116
125
var m = $umf . compile ( '/users/:id/details/{type}/{repeat:[0-9]+}?from&to' ) ;
117
126
expect ( m . exec ( '/users/123/details/what/thisShouldBeDigits' , { } ) ) . toBeNull ( ) ;
You can’t perform that action at this time.
0 commit comments