diff --git a/src/http/mime.cpp b/src/http/mime.cpp index 36abae6..cca4e2f 100644 --- a/src/http/mime.cpp +++ b/src/http/mime.cpp @@ -1,4 +1,5 @@ #include "../logger.hpp" +#include #include "mime.hpp" #include @@ -13,13 +14,7 @@ namespace Http multipart */ - std::string GetMimeType(std::filesystem::path const & path) - { - auto const extension = path.extension(); - return GetMimeType(extension.string()); - } - - std::string GetMimeType(std::string const & extension) + std::string GetMimeType(std::string const & filePath) { static std::unordered_map fileExtensionMap { @@ -33,7 +28,8 @@ namespace Http {".mp3", FileType::MP3}, {".mp4", FileType::MP4}, }; - + + std::string const extension = std::filesystem::path(filePath).extension(); auto const findResult = fileExtensionMap.find(extension); if (findResult == fileExtensionMap.end()) { diff --git a/src/http/mime.hpp b/src/http/mime.hpp index 64b4528..5f145f6 100644 --- a/src/http/mime.hpp +++ b/src/http/mime.hpp @@ -1,5 +1,4 @@ #pragma once -#include #include #include @@ -17,7 +16,6 @@ namespace Http MP4 }; - std::string GetMimeType(std::filesystem::path const & path); - std::string GetMimeType(std::string const & extension); + std::string GetMimeType(std::string const & filePath); std::string GetMimeType(FileType const fileType); } \ No newline at end of file