diff --git a/src/index/mimetype.cpp b/src/index/mimetype.cpp index 9d62fe7d..a295ec0e 100644 --- a/src/index/mimetype.cpp +++ b/src/index/mimetype.cpp @@ -162,11 +162,13 @@ string mimetype(const string &fn, const struct stat *stp, } // Compute file name suffix and search the mimetype map - string::size_type dot = fn.find_last_of("."); - string suff; - if (dot != string::npos) { - suff = stringtolower(fn.substr(dot)); + string::size_type dot = fn.find_first_of("."); + while (dot != string::npos) { + string suff = stringtolower(fn.substr(dot)); mtype = cfg->getMimeTypeFromSuffix(suff); + if (!mtype.empty() || dot >= fn.size() - 1) + break; + dot = fn.find_first_of(".", dot + 1); } // If type was not determined from suffix, examine file data. Can