mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-23 03:52:35 -04:00
Fix #211: getMimeTypeForFile does not handle files without extensions correctly
Use `auto` instead of `unsigned int` to ensure proper size on 64-bit platforms
This commit is contained in:
parent
0785636ca5
commit
221f3ef340
@ -130,7 +130,7 @@ get_from_humanReadableBookId(const std::string& humanReadableBookId) {
|
|||||||
static std::string getMimeTypeForFile(const std::string& filename)
|
static std::string getMimeTypeForFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
std::string mimeType = "text/plain";
|
std::string mimeType = "text/plain";
|
||||||
unsigned int pos = filename.find_last_of(".");
|
auto pos = filename.find_last_of(".");
|
||||||
|
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
std::string extension = filename.substr(pos + 1);
|
std::string extension = filename.substr(pos + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user