|
@@ -70,30 +70,29 @@ void MimeData::set_text(const String& text)
|
|
set_data("text/plain", text.to_byte_buffer());
|
|
set_data("text/plain", text.to_byte_buffer());
|
|
}
|
|
}
|
|
|
|
|
|
-String guess_mime_type_based_on_filename(const URL& url)
|
|
|
|
|
|
+String guess_mime_type_based_on_filename(const StringView& path)
|
|
{
|
|
{
|
|
- String lowercase_url = url.path().to_lowercase();
|
|
|
|
- if (lowercase_url.ends_with(".pbm"))
|
|
|
|
|
|
+ if (path.ends_with(".pbm", CaseSensitivity::CaseInsensitive))
|
|
return "image/x‑portable‑bitmap";
|
|
return "image/x‑portable‑bitmap";
|
|
- if (url.path().ends_with(".pgm"))
|
|
|
|
|
|
+ if (path.ends_with(".pgm", CaseSensitivity::CaseInsensitive))
|
|
return "image/x‑portable‑graymap";
|
|
return "image/x‑portable‑graymap";
|
|
- if (url.path().ends_with(".png"))
|
|
|
|
|
|
+ if (path.ends_with(".png", CaseSensitivity::CaseInsensitive))
|
|
return "image/png";
|
|
return "image/png";
|
|
- if (lowercase_url.ends_with(".ppm"))
|
|
|
|
|
|
+ if (path.ends_with(".ppm", CaseSensitivity::CaseInsensitive))
|
|
return "image/x‑portable‑pixmap";
|
|
return "image/x‑portable‑pixmap";
|
|
- if (lowercase_url.ends_with(".gif"))
|
|
|
|
|
|
+ if (path.ends_with(".gif", CaseSensitivity::CaseInsensitive))
|
|
return "image/gif";
|
|
return "image/gif";
|
|
- if (lowercase_url.ends_with(".bmp"))
|
|
|
|
|
|
+ if (path.ends_with(".bmp", CaseSensitivity::CaseInsensitive))
|
|
return "image/bmp";
|
|
return "image/bmp";
|
|
- if (lowercase_url.ends_with(".jpg") || lowercase_url.ends_with(".jpeg"))
|
|
|
|
|
|
+ if (path.ends_with(".jpg", CaseSensitivity::CaseInsensitive) || path.ends_with(".jpeg", CaseSensitivity::CaseInsensitive))
|
|
return "image/jpeg";
|
|
return "image/jpeg";
|
|
- if (lowercase_url.ends_with(".svg"))
|
|
|
|
|
|
+ if (path.ends_with(".svg", CaseSensitivity::CaseInsensitive))
|
|
return "image/svg+xml";
|
|
return "image/svg+xml";
|
|
- if (lowercase_url.ends_with(".md"))
|
|
|
|
|
|
+ if (path.ends_with(".md", CaseSensitivity::CaseInsensitive))
|
|
return "text/markdown";
|
|
return "text/markdown";
|
|
- if (lowercase_url.ends_with(".html") || lowercase_url.ends_with(".htm"))
|
|
|
|
|
|
+ if (path.ends_with(".html", CaseSensitivity::CaseInsensitive) || path.ends_with(".htm", CaseSensitivity::CaseInsensitive))
|
|
return "text/html";
|
|
return "text/html";
|
|
- if (lowercase_url.ends_with("/"))
|
|
|
|
|
|
+ if (path.ends_with("/", CaseSensitivity::CaseInsensitive))
|
|
return "text/html";
|
|
return "text/html";
|
|
return "text/plain";
|
|
return "text/plain";
|
|
}
|
|
}
|