Skip to content

Fix allow_unknown_extensions = true#12

Merged
ThinkerDreamer merged 2 commits into
M4SS-Code:mainfrom
pacman82:main
Apr 8, 2026
Merged

Fix allow_unknown_extensions = true#12
ThinkerDreamer merged 2 commits into
M4SS-Code:mainfrom
pacman82:main

Conversation

@pacman82
Copy link
Copy Markdown
Contributor

@pacman82 pacman82 commented Apr 8, 2026

Hello Dear Maintainers,

thanks for this crate. I like it a lot. I already use it in a pet project of mine. I can not yet use it in my dayjob though. Responsible is this bug:

allow_unknown_extensions = true currently sets all content-type headers to application/octet-stream. Even if their mime type is known.

This PR provides a reproducing test and a fix.

Best, Markus

@ThinkerDreamer
Copy link
Copy Markdown
Member

Great catch, @pacman82! The bug is ok_or() vs ok_or_else(). The original should have used ok_or_else() since https://doc.rust-lang.org/std/option/enum.Option.html#method.ok_or says:

Arguments passed to ok_or are eagerly evaluated; if you are passing the result of a function call, it is recommended to use ok_or_else, which is lazily evaluated.

Thanks!

@ThinkerDreamer ThinkerDreamer merged commit 73547c4 into M4SS-Code:main Apr 8, 2026
8 checks passed
@paolobarbolini
Copy link
Copy Markdown
Member

Released as v0.6.1
https://crates.io/crates/static-serve/0.6.1

@pacman82
Copy link
Copy Markdown
Contributor Author

pacman82 commented Apr 8, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants