@@ -44,6 +44,19 @@ impl UrlPattern {
4444 None => ( None , options) ,
4545 } ;
4646
47+ let options = if let Some ( options) = options {
48+ :: urlpattern:: UrlPatternOptions {
49+ ignore_case : options
50+ . get_item ( "ignoreCase" ) ?
51+ . map ( |v| v. extract :: < bool > ( ) )
52+ . transpose ( ) ?
53+ . unwrap_or ( false ) ,
54+ ..:: urlpattern:: UrlPatternOptions :: default ( )
55+ }
56+ } else {
57+ :: urlpattern:: UrlPatternOptions :: default ( )
58+ } ;
59+
4760 let init: :: urlpattern:: UrlPatternInit = match input {
4861 Some ( UrlPatternInput :: String ( input) ) => {
4962 :: urlpattern:: UrlPatternInit :: parse_constructor_string :: < regex:: Regex > (
@@ -102,18 +115,7 @@ impl UrlPattern {
102115 }
103116 None => :: urlpattern:: UrlPatternInit :: default ( ) ,
104117 } ;
105- let options = if let Some ( options) = options {
106- :: urlpattern:: UrlPatternOptions {
107- ignore_case : options
108- . get_item ( "ignoreCase" ) ?
109- . map ( |v| v. extract :: < bool > ( ) )
110- . transpose ( ) ?
111- . unwrap_or ( false ) ,
112- ..:: urlpattern:: UrlPatternOptions :: default ( )
113- }
114- } else {
115- :: urlpattern:: UrlPatternOptions :: default ( )
116- } ;
118+
117119 Ok ( Self (
118120 :: urlpattern:: UrlPattern :: parse ( init, options) . map_err ( Error ) ?,
119121 ) )
@@ -212,6 +214,7 @@ impl UrlPattern {
212214 :: urlpattern:: UrlPatternMatchInput :: Init ( :: urlpattern:: UrlPatternInit :: default ( ) )
213215 }
214216 } ;
217+
215218 Ok ( self . 0 . test ( input) . map_err ( Error ) ?)
216219 }
217220
0 commit comments