mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-05-01 00:44:30 +00:00
LaunchServer: Remove usage of DeprecatedFile
And use the new `guess_mime_type_based_on_sniffed_bytes` helper.
This commit is contained in:
committed by
Andreas Kling
parent
50b5528746
commit
d7ca3a5196
@@ -179,16 +179,11 @@ Vector<DeprecatedString> Launcher::handlers_with_details_for_url(const URL& url)
|
||||
|
||||
Optional<DeprecatedString> Launcher::mime_type_for_file(DeprecatedString path)
|
||||
{
|
||||
auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly);
|
||||
if (file_or_error.is_error()) {
|
||||
auto file_or_error = Core::File::open(path, Core::File::OpenMode::Read);
|
||||
if (file_or_error.is_error())
|
||||
return {};
|
||||
} else {
|
||||
auto file = file_or_error.release_value();
|
||||
// Read accounts for longest possible offset + signature we currently match against.
|
||||
auto bytes = file->read(0x9006);
|
||||
|
||||
return Core::guess_mime_type_based_on_sniffed_bytes(bytes.bytes());
|
||||
}
|
||||
return Core::guess_mime_type_based_on_sniffed_bytes(*file_or_error.release_value());
|
||||
}
|
||||
|
||||
bool Launcher::open_url(const URL& url, DeprecatedString const& handler_name)
|
||||
|
||||
Reference in New Issue
Block a user