Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibURL+LibWeb+UI: Remove the implicit URL constructors #3668

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
LibWeb/Loader: Explicitly parse URL generating directory response
Removing one more caller of the implicit URL constructors.
  • Loading branch information
shannonbooth committed Feb 22, 2025
commit 3add0f091532b70bce18ed32a0a3a30109455ccf
6 changes: 5 additions & 1 deletion Libraries/LibWeb/Loader/ResourceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
#include <LibCore/Directory.h>
#include <LibCore/MimeData.h>
#include <LibCore/Resource.h>
#include <LibGC/Function.h>
#include <LibHTTP/HttpResponse.h>
#include <LibRequests/Request.h>
#include <LibRequests/RequestClient.h>
#include <LibURL/Parser.h>
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/Fetch/Infrastructure/URL.h>
Expand Down Expand Up @@ -320,7 +322,9 @@ void ResourceLoader::load(LoadRequest& request, GC::Root<SuccessCallback> succes

// When resource URI is a directory use file directory loader to generate response
if (resource.value()->is_directory()) {
respond_directory_page(request, resource.value()->file_url(), success_callback, error_callback);
auto url = URL::Parser::basic_parse(resource.value()->file_url());
VERIFY(url.has_value());
Comment on lines +325 to +326
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this a bunch makes me wonder if we should just have an explicit infallible URL parser

respond_directory_page(request, url.release_value(), success_callback, error_callback);
return;
}

Expand Down