mh_execm: compute file md5 before activating filter to avoid concurrent open issues on Windows
This commit is contained in:
parent
c333321423
commit
d410c867e7
1 changed files with 15 additions and 8 deletions
|
@ -172,8 +172,21 @@ bool MimeHandlerExecMultiple::next_document()
|
||||||
// Send request to child process. This maybe the first/only
|
// Send request to child process. This maybe the first/only
|
||||||
// request for a given file, or a continuation request. We send an
|
// request for a given file, or a continuation request. We send an
|
||||||
// empty file name in the latter case.
|
// empty file name in the latter case.
|
||||||
|
// We also compute the file md5 before starting the extraction:
|
||||||
|
// under Windows, we may not be able to do it while the file
|
||||||
|
// is opened by the filter
|
||||||
ostringstream obuf;
|
ostringstream obuf;
|
||||||
|
string file_md5;
|
||||||
if (m_filefirst) {
|
if (m_filefirst) {
|
||||||
|
if (!m_forPreview) {
|
||||||
|
string md5, xmd5, reason;
|
||||||
|
if (MD5File(m_fn, md5, &reason)) {
|
||||||
|
file_md5 = MD5HexPrint(md5, xmd5);
|
||||||
|
} else {
|
||||||
|
LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n",
|
||||||
|
m_fn.c_str(), reason.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
obuf << "FileName: " << m_fn.length() << "\n" << m_fn;
|
obuf << "FileName: " << m_fn.length() << "\n" << m_fn;
|
||||||
// m_filefirst is set to true by set_document_file()
|
// m_filefirst is set to true by set_document_file()
|
||||||
m_filefirst = false;
|
m_filefirst = false;
|
||||||
|
@ -301,14 +314,8 @@ bool MimeHandlerExecMultiple::next_document()
|
||||||
m_metaData[cstr_dj_keymt] = mtype.empty() ? "text/html" : mtype;
|
m_metaData[cstr_dj_keymt] = mtype.empty() ? "text/html" : mtype;
|
||||||
m_metaData.erase(cstr_dj_keyipath);
|
m_metaData.erase(cstr_dj_keyipath);
|
||||||
if (!m_forPreview) {
|
if (!m_forPreview) {
|
||||||
string md5, xmd5, reason;
|
m_metaData[cstr_dj_keymd5] = file_md5;
|
||||||
if (MD5File(m_fn, md5, &reason)) {
|
}
|
||||||
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
|
|
||||||
} else {
|
|
||||||
LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n",
|
|
||||||
m_fn.c_str(), reason.c_str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_cs(m_metaData[cstr_dj_keymt], charset);
|
handle_cs(m_metaData[cstr_dj_keymt], charset);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue