Skip to content

Commit cc18ba3

Browse files
committed
Prevent base_url from being provided when input is a Hash
1 parent ee9a193 commit cc18ba3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ext/urlpattern/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ impl UrlPattern {
132132
}
133133
}
134134
Some(input) if input.is_kind_of(ruby.class_hash()) => {
135+
if base_url.is_some() {
136+
return Err(Error::new(
137+
error_class,
138+
"base_url cannot be provided when input is a Hash",
139+
));
140+
}
141+
135142
let input = RHash::try_convert(input)?;
136143

137144
urlpattern::UrlPatternMatchInput::Init(urlpattern::UrlPatternInit {
@@ -198,6 +205,13 @@ impl UrlPattern {
198205
}
199206
}
200207
Some(input) if input.is_kind_of(ruby.class_hash()) => {
208+
if base_url.is_some() {
209+
return Err(Error::new(
210+
error_class,
211+
"base_url cannot be provided when input is a Hash",
212+
));
213+
}
214+
201215
let input = RHash::try_convert(input)?;
202216

203217
urlpattern::UrlPatternMatchInput::Init(urlpattern::UrlPatternInit {

0 commit comments

Comments
 (0)