The record for an attachment for which conversion failed (ie: image without exiftool) would erase the message's record because its ipath was not updated
This commit is contained in:
parent
57dfcdd4d3
commit
6b04fe7f2c
@ -610,7 +610,7 @@ bool FileInterner::dijontorcl(Rcl::Doc& doc)
|
|||||||
// with an ipath, not the last one which is usually text/plain
|
// with an ipath, not the last one which is usually text/plain
|
||||||
// We also set the author and modification time from the last doc
|
// We also set the author and modification time from the last doc
|
||||||
// which has them.
|
// which has them.
|
||||||
void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) const
|
void FileInterner::collectIpathAndMT(Rcl::Doc& doc) const
|
||||||
{
|
{
|
||||||
LOGDEB2(("FileInterner::collectIpathAndMT\n"));
|
LOGDEB2(("FileInterner::collectIpathAndMT\n"));
|
||||||
bool hasipath = false;
|
bool hasipath = false;
|
||||||
@ -638,9 +638,9 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) const
|
|||||||
getKeyValue(docdata, keymt, doc.mimetype);
|
getKeyValue(docdata, keymt, doc.mimetype);
|
||||||
getKeyValue(docdata, keyfn, doc.utf8fn);
|
getKeyValue(docdata, keyfn, doc.utf8fn);
|
||||||
}
|
}
|
||||||
ipath += colon_hide(ipathel) + isep;
|
doc.ipath += colon_hide(ipathel) + isep;
|
||||||
} else {
|
} else {
|
||||||
ipath += isep;
|
doc.ipath += isep;
|
||||||
}
|
}
|
||||||
getKeyValue(docdata, keyau, doc.meta[Rcl::Doc::keyau]);
|
getKeyValue(docdata, keyau, doc.meta[Rcl::Doc::keyau]);
|
||||||
getKeyValue(docdata, keymd, doc.dmtime);
|
getKeyValue(docdata, keymd, doc.dmtime);
|
||||||
@ -648,14 +648,14 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) const
|
|||||||
|
|
||||||
// Trim empty tail elements in ipath.
|
// Trim empty tail elements in ipath.
|
||||||
if (hasipath) {
|
if (hasipath) {
|
||||||
LOGDEB2(("IPATH [%s]\n", ipath.c_str()));
|
LOGDEB2(("IPATH [%s]\n", doc.ipath.c_str()));
|
||||||
string::size_type sit = ipath.find_last_not_of(isep);
|
string::size_type sit = doc.ipath.find_last_not_of(isep);
|
||||||
if (sit == string::npos)
|
if (sit == string::npos)
|
||||||
ipath.erase();
|
doc.ipath.erase();
|
||||||
else if (sit < ipath.length() -1)
|
else if (sit < doc.ipath.length() -1)
|
||||||
ipath.erase(sit+1);
|
doc.ipath.erase(sit+1);
|
||||||
} else {
|
} else {
|
||||||
ipath.erase();
|
doc.ipath.erase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,14 +763,14 @@ int FileInterner::addHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Information and debug after a next_document error
|
// Information and debug after a next_document error
|
||||||
void FileInterner::processNextDocError(Rcl::Doc &doc, string& ipath)
|
void FileInterner::processNextDocError(Rcl::Doc &doc)
|
||||||
{
|
{
|
||||||
collectIpathAndMT(doc, ipath);
|
collectIpathAndMT(doc);
|
||||||
m_reason = m_handlers.back()->get_error();
|
m_reason = m_handlers.back()->get_error();
|
||||||
checkExternalMissing(m_reason, doc.mimetype);
|
checkExternalMissing(m_reason, doc.mimetype);
|
||||||
LOGERR(("FileInterner::internfile: next_document error "
|
LOGERR(("FileInterner::internfile: next_document error "
|
||||||
"[%s%s%s] %s %s\n", m_fn.c_str(), ipath.empty() ? "" : "|",
|
"[%s%s%s] %s %s\n", m_fn.c_str(), doc.ipath.empty() ? "" : "|",
|
||||||
ipath.c_str(), doc.mimetype.c_str(), m_reason.c_str()));
|
doc.ipath.c_str(), doc.mimetype.c_str(), m_reason.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath)
|
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath)
|
||||||
@ -841,8 +841,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
|
|||||||
// might be ie an error while decoding an attachment, but we
|
// might be ie an error while decoding an attachment, but we
|
||||||
// still want to process the rest of the mbox! For preview: fatal.
|
// still want to process the rest of the mbox! For preview: fatal.
|
||||||
if (!m_handlers.back()->next_document()) {
|
if (!m_handlers.back()->next_document()) {
|
||||||
string oipath;
|
processNextDocError(doc);
|
||||||
processNextDocError(doc, oipath);
|
|
||||||
if (m_forPreview) {
|
if (m_forPreview) {
|
||||||
m_reason += "Requested document does not exist. ";
|
m_reason += "Requested document does not exist. ";
|
||||||
m_reason += m_handlers.back()->get_error();
|
m_reason += m_handlers.back()->get_error();
|
||||||
@ -902,7 +901,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
|
|||||||
// internal to the document (by dijontorcl()) if any, so the order
|
// internal to the document (by dijontorcl()) if any, so the order
|
||||||
// of calls is important.
|
// of calls is important.
|
||||||
if (!m_forPreview) {
|
if (!m_forPreview) {
|
||||||
collectIpathAndMT(doc, doc.ipath);
|
collectIpathAndMT(doc);
|
||||||
} else {
|
} else {
|
||||||
doc.mimetype = m_reachedMType;
|
doc.mimetype = m_reachedMType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,12 +236,12 @@ class FileInterner {
|
|||||||
|
|
||||||
void tmpcleanup();
|
void tmpcleanup();
|
||||||
bool dijontorcl(Rcl::Doc&);
|
bool dijontorcl(Rcl::Doc&);
|
||||||
void collectIpathAndMT(Rcl::Doc&, string& ipath) const;
|
void collectIpathAndMT(Rcl::Doc&) const;
|
||||||
bool dataToTempFile(const string& data, const string& mt, string& fn);
|
bool dataToTempFile(const string& data, const string& mt, string& fn);
|
||||||
void popHandler();
|
void popHandler();
|
||||||
int addHandler();
|
int addHandler();
|
||||||
void checkExternalMissing(const string& msg, const string& mt);
|
void checkExternalMissing(const string& msg, const string& mt);
|
||||||
void processNextDocError(Rcl::Doc &doc, string& ipath);
|
void processNextDocError(Rcl::Doc &doc);
|
||||||
#ifdef RCL_USE_XATTR
|
#ifdef RCL_USE_XATTR
|
||||||
void reapXAttrs(const string& fn);
|
void reapXAttrs(const string& fn);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user