summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-11-18 00:19:13 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-11-18 00:19:13 +0100
commit0277b7075475326f2c39fe09b4d7424b6f9111a0 (patch)
treea3bcd1c2b5c53e4a5d1695632b07ad48f1efd170 /src
parent74289c038e4a6a23a0b287085265205dd4bdc58e (diff)
mime_types: Make extension lookup case-insensitive
Not all extensions are but for image and video I know of none that are case sensitive.
Diffstat (limited to 'src')
-rw-r--r--src/mime_types.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mime_types.cc b/src/mime_types.cc
index 1332f5a..dd8e3a7 100644
--- a/src/mime_types.cc
+++ b/src/mime_types.cc
@@ -1,6 +1,7 @@
#include "common.hh"
#include "mime_types.hh"
+#include "strutil.hh"
#include <unordered_map>
@@ -20,7 +21,7 @@ std::unordered_map<std::string_view, std::string_view> kExtensionMap({
} // namespace
std::string_view from_extension(std::string_view ext) {
- auto it = kExtensionMap.find(ext);
+ auto it = kExtensionMap.find(str::to_lower_ascii(ext));
if (it == kExtensionMap.end())
return std::string_view();
return it->second;