diff --git a/src/index/fsindexer.cpp b/src/index/fsindexer.cpp index eca5e78a..8f53a1ae 100644 --- a/src/index/fsindexer.cpp +++ b/src/index/fsindexer.cpp @@ -388,6 +388,11 @@ FsIndexer::processone(const std::string &fn, const struct stat *stp, displayableBytes(stp->st_size).c_str(), fn.c_str())); FileInterner interner(fn, stp, m_config, m_tmpdir, FileInterner::FIF_none); + if (!interner.ok()) { + // no indexing whatsoever in this case. This typically means that + // indexallfilenames is not set + return FsTreeWalker::FtwOk; + } // File name transcoded to utf8 for indexation. string charset = m_config->getDefCharset(true); diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index d0217603..98fd98d1 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -172,7 +172,7 @@ void FileInterner::tmpcleanup() FileInterner::FileInterner(const string &f, const struct stat *stp, RclConfig *cnf, const string& td, int flags, const string *imime) - : m_tdir(td) + : m_tdir(td), m_ok(false) { initcommon(cnf, flags); init(f, stp, cnf, td, flags, imime); @@ -282,12 +282,13 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf, m_handlers.push_back(df); LOGDEB(("FileInterner::FileInterner: %s [%s]\n", l_mime.c_str(), m_fn.c_str())); + m_ok = true; } // Setup from memory data (ie: out of the web cache). imime needs to be set. FileInterner::FileInterner(const string &data, RclConfig *cnf, const string& td, int flags, const string& imime) - : m_tdir(td) + : m_tdir(td), m_ok(false) { initcommon(cnf, flags); init(data, cnf, td, flags, imime); @@ -338,6 +339,7 @@ void FileInterner::init(const string &data, RclConfig *cnf, return; } m_handlers.push_back(df); + m_ok = true; } void FileInterner::initcommon(RclConfig *cnf, int flags) @@ -353,7 +355,7 @@ void FileInterner::initcommon(RclConfig *cnf, int flags) FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf, const string& td, int flags) - : m_tdir(td) + : m_tdir(td), m_ok(false) { LOGDEB(("FileInterner::FileInterner(idoc)\n")); initcommon(cnf, flags); diff --git a/src/internfile/internfile.h b/src/internfile/internfile.h index 40711a08..79340fac 100644 --- a/src/internfile/internfile.h +++ b/src/internfile/internfile.h @@ -159,6 +159,7 @@ class FileInterner { const string& getReason() const {return m_reason;} static void getMissingExternal(string& missing); static void getMissingDescription(string& desc); + bool ok() {return m_ok;} private: static const unsigned int MAXHANDLERS = 20; @@ -172,6 +173,7 @@ class FileInterner { // m_tdir and m_tfile are used only for decompressing input file if needed const string& m_tdir; string m_tfile; + bool m_ok; // Set after construction if ok #ifdef RCL_USE_XATTR // Fields found in file extended attributes. This is kept here, // not in the file-level handler because we are only interested in