LibWeb: Make MimeSniff::MimeType::parse() infallible

It already returns an empty Optional for failures, so there's no need to
wrap it in an ErrorOr as well.
This commit is contained in:
Andreas Kling 2024-10-14 11:18:44 +02:00 committed by Andreas Kling
commit 5c20bc2afc
Notes: github-actions[bot] 2024-10-14 18:48:45 +00:00
15 changed files with 39 additions and 37 deletions

View file

@ -204,7 +204,7 @@ JS::NonnullGCPtr<Blob> Blob::create(JS::Realm& realm, Optional<Vector<BlobPart>>
// NOTE: The spec is out of date, and we are supposed to call into the MimeType parser here.
if (!options->type.is_empty()) {
auto maybe_parsed_type = MUST(Web::MimeSniff::MimeType::parse(options->type));
auto maybe_parsed_type = Web::MimeSniff::MimeType::parse(options->type);
if (maybe_parsed_type.has_value())
type = maybe_parsed_type->serialized();