1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:25:10 +00:00

LibCore+WebServer+LibWeb: Make MIME type guesser take a StringView

This reverts my previous commit in WebServer and fixes the whole issue
in a much better way. Instead of having the MIME type guesser take a
URL (which we don't actually have in the WebServer at that point),
just take a path as a StringView.

Also, make use of the case-insensitive StringView::ends_with() :^)
This commit is contained in:
Andreas Kling 2020-10-21 21:14:16 +02:00
parent 9c14e2ea5d
commit 5043c4a3e5
4 changed files with 15 additions and 25 deletions

View file

@ -109,7 +109,7 @@ void Resource::did_load(Badge<ResourceLoader>, const ByteBuffer& data, const Has
dbg() << "No Content-Type header to go on! Guessing based on filename...";
#endif
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
m_mime_type = Core::guess_mime_type_based_on_filename(url());
m_mime_type = Core::guess_mime_type_based_on_filename(url().path());
}
for_each_client([](auto& client) {