mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Make MimeSniff::Resource::sniff() infallible
Everyone was already using this API as if it were infallible anyway.
This commit is contained in:
parent
5c20bc2afc
commit
600cb5ccba
Notes:
github-actions[bot]
2024-10-14 18:48:40 +00:00
Author: https://github.com/awesomekling
Commit: 600cb5ccba
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1796
7 changed files with 103 additions and 106 deletions
|
@ -183,7 +183,7 @@ ErrorOr<NonnullRefPtr<Gfx::Typeface>> FontLoader::try_load_font()
|
|||
// FIXME: This could maybe use the format() provided in @font-face as well, since often the mime type is just application/octet-stream and we have to try every format
|
||||
auto mime_type = MimeSniff::MimeType::parse(resource()->mime_type());
|
||||
if (!mime_type.has_value() || !mime_type->is_font()) {
|
||||
mime_type = MUST(MimeSniff::Resource::sniff(resource()->encoded_data(), Web::MimeSniff::SniffingConfiguration { .sniffing_context = Web::MimeSniff::SniffingContext::Font }));
|
||||
mime_type = MimeSniff::Resource::sniff(resource()->encoded_data(), Web::MimeSniff::SniffingConfiguration { .sniffing_context = Web::MimeSniff::SniffingContext::Font });
|
||||
}
|
||||
if (mime_type.has_value()) {
|
||||
if (mime_type->essence() == "font/ttf"sv || mime_type->essence() == "application/x-font-ttf"sv) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue