From f27b9b95636db9c0070bd2f375ea5be2e613a06f Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Thu, 6 Jul 2023 19:25:35 +0200 Subject: [PATCH] LibWeb: Set Content-Type for data: URLs instead of checking MIME on load This makes the loader more agnostic. Additionally, this allows us to load tab in Ladybird with a 'data:' URL containing parameters, as a Resource will now call `mime_type_from_content_type` to extract the content type from MIME. :^) --- Userland/Libraries/LibWeb/Loader/Resource.cpp | 3 --- Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp index 21b002f039b..cd741769f33 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.cpp +++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp @@ -102,9 +102,6 @@ void Resource::did_load(Badge, ReadonlyBytes data, HashMap response_headers; + response_headers.set("Content-Type", url.data_mime_type()); + log_success(request); - Platform::EventLoopPlugin::the().deferred_invoke([data = move(data), success_callback = move(success_callback)] { - success_callback(data, {}, {}); + Platform::EventLoopPlugin::the().deferred_invoke([data = move(data), response_headers = move(response_headers), success_callback = move(success_callback)] { + success_callback(data, response_headers, {}); }); return; }