Skip to content

Commit f83e425

Browse files
committed
use match to check error
1 parent ccb085f commit f83e425

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/content/content_location.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ impl ContentLocation {
5252
// If we successfully parsed the header then there's always at least one
5353
// entry. We want the last entry.
5454
let value = headers.iter().last().unwrap();
55-
let base = base_url.try_into()?;
56-
let url = base.join(value.as_str().trim()).status(400)?;
57-
Ok(Some(Self { url }))
55+
let base = base_url.try_into().ok();
56+
match base {
57+
Some(base) => {
58+
let url = base.join(value.as_str().trim()).status(400)?;
59+
Ok(Some(Self { url }))
60+
}
61+
None => Ok(None),
62+
}
5863
}
5964

6065
/// Sets the header.

0 commit comments

Comments
 (0)