mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:27:42 +00:00
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. :^)
This commit is contained in:
parent
16836e7e62
commit
f27b9b9563
2 changed files with 5 additions and 5 deletions
|
@ -102,9 +102,6 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<Depre
|
|||
// Let's use image/x-qoi for now, which is also what our Core::MimeData uses & would guess.
|
||||
if (m_mime_type == "application/octet-stream" && url().serialize_path().ends_with(".qoi"sv))
|
||||
m_mime_type = "image/x-qoi";
|
||||
} else if (url().scheme() == "data" && !url().data_mime_type().is_empty()) {
|
||||
dbgln_if(RESOURCE_DEBUG, "This is a data URL with mime-type _{}_", url().data_mime_type());
|
||||
m_mime_type = url().data_mime_type();
|
||||
} else {
|
||||
auto content_type_options = headers.get("X-Content-Type-Options");
|
||||
if (content_type_options.value_or("").equals_ignoring_ascii_case("nosniff"sv)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue