From e515b9a9f905609c0bdc5cb746ee6af1a84e5e83 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 17 Jun 2013 11:52:04 +0200 Subject: [PATCH] Ignore empty mime_type extended attribute returned by bug in CIFS linux kernel module (samba mounts) --- src/index/mimetype.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index/mimetype.cpp b/src/index/mimetype.cpp index be4c8999..b37f6249 100644 --- a/src/index/mimetype.cpp +++ b/src/index/mimetype.cpp @@ -134,11 +134,18 @@ string mimetype(const string &fn, const struct stat *stp, // Extended attribute has priority on everything, as per: // http://freedesktop.org/wiki/CommonExtendedAttributes if (pxattr::get(fn, "mime_type", &mtype)) { - return mtype; + LOGDEB0(("Mimetype: 'mime_type' xattr : [%s]\n", mtype.c_str())); + if (mtype.empty()) { + LOGDEB0(("Mimetype: getxattr() returned empty mime type !\n")); + } else { + return mtype; + } } - if (cfg == 0) // ?!? + if (cfg == 0) { + LOGERR(("Mimetype: null config ??\n")); return mtype; + } if (cfg->inStopSuffixes(fn)) { LOGDEB(("mimetype: fn [%s] in stopsuffixes\n", fn.c_str()));