1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:47:44 +00:00

WebServer: Prefer LibFileSystem over DeprecatedFile

This commit is contained in:
Ben Wiederhake 2023-05-20 00:34:51 +02:00 committed by Andreas Kling
parent fecaf27b3a
commit e795641d99
2 changed files with 4 additions and 7 deletions

View file

@ -14,7 +14,6 @@
#include <AK/StringBuilder.h>
#include <AK/URL.h>
#include <LibCore/DateTime.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
@ -144,13 +143,12 @@ ErrorOr<bool> Client::handle_request(HTTP::HttpRequest const& request)
real_path = index_html_path;
}
auto file = Core::DeprecatedFile::construct(real_path.bytes_as_string_view());
if (!file->open(Core::OpenMode::ReadOnly)) {
if (!FileSystem::exists(real_path.bytes_as_string_view())) {
TRY(send_error_response(404, request));
return false;
}
if (file->is_device()) {
if (FileSystem::is_device(real_path.bytes_as_string_view())) {
TRY(send_error_response(403, request));
return false;
}