Skip to content

Commit 2ef6fa1

Browse files
committed
chore: incorporated review feedback from @vdice
Signed-off-by: Thorsten Hans <[email protected]>
1 parent c9611e3 commit 2ef6fa1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ trait IsFavicon {
126126

127127
impl IsFavicon for PathBuf {
128128
fn is_favicon(&self) -> bool {
129-
match self.clone().into_os_string().into_string() {
130-
Ok(s) => s == FAVICON_ICO_FILENAME || s == FAVICON_PNG_FILENAME,
131-
Err(_) => false,
129+
match self.clone().file_name() {
130+
Some(s) => s == FAVICON_ICO_FILENAME || s == FAVICON_PNG_FILENAME,
131+
None => false,
132132
}
133133
}
134134
}
@@ -469,7 +469,10 @@ mod tests {
469469
let req = spin_http::Request {
470470
method: spin_http::Method::Get,
471471
uri: "http://thisistest.com/".to_string(),
472-
headers: vec![(PATH_INFO_HEADER.to_string(), "favicon.png".to_string())],
472+
headers: vec![(
473+
PATH_INFO_HEADER.to_string(),
474+
FAVICON_PNG_FILENAME.to_string(),
475+
)],
473476
params: vec![],
474477
body: None,
475478
};

0 commit comments

Comments
 (0)