added compressedfilemaxkbs
This commit is contained in:
parent
a5b5faae3a
commit
bf16706d50
@ -158,16 +158,24 @@ FileInterner::FileInterner(const std::string &f, const struct stat *stp,
|
|||||||
// identification, then do the rest with the temp file.
|
// identification, then do the rest with the temp file.
|
||||||
list<string>ucmd;
|
list<string>ucmd;
|
||||||
if (m_cfg->getUncompressor(l_mime, ucmd)) {
|
if (m_cfg->getUncompressor(l_mime, ucmd)) {
|
||||||
if (!uncompressfile(m_cfg, m_fn, ucmd, m_tdir, m_tfile)) {
|
// Check for compressed size limit
|
||||||
return;
|
int maxkbs = -1;
|
||||||
|
if (!m_cfg->getConfParam("compressedfilemaxkbs", &maxkbs) ||
|
||||||
|
maxkbs < 0 || !stp || int(stp->st_size / 1024) < maxkbs) {
|
||||||
|
if (!uncompressfile(m_cfg, m_fn, ucmd, m_tdir, m_tfile)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOGDEB1(("internfile: after ucomp: m_tdir %s, tfile %s\n",
|
||||||
|
m_tdir.c_str(), m_tfile.c_str()));
|
||||||
|
m_fn = m_tfile;
|
||||||
|
// Note: still using the original file's stat. right ?
|
||||||
|
l_mime = mimetype(m_fn, stp, m_cfg, usfci);
|
||||||
|
if (l_mime.empty() && imime)
|
||||||
|
l_mime = *imime;
|
||||||
|
} else {
|
||||||
|
LOGINFO(("internfile: %s over size limit %d kbs\n",
|
||||||
|
m_fn.c_str(), maxkbs));
|
||||||
}
|
}
|
||||||
LOGDEB1(("internfile: after ucomp: m_tdir %s, tfile %s\n",
|
|
||||||
m_tdir.c_str(), m_tfile.c_str()));
|
|
||||||
m_fn = m_tfile;
|
|
||||||
// Note: still using the original file's stat. right ?
|
|
||||||
l_mime = mimetype(m_fn, stp, m_cfg, usfci);
|
|
||||||
if (l_mime.empty() && imime)
|
|
||||||
l_mime = *imime;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -353,6 +353,18 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
|||||||
"cannot be identified or processed (no or "
|
"cannot be identified or processed (no or "
|
||||||
"unsupported mime type). Default true"));
|
"unsupported mime type). Default true"));
|
||||||
m_widgets.push_back(eafln);
|
m_widgets.push_back(eafln);
|
||||||
|
|
||||||
|
ConfLink lnkzfmaxkbs(new ConfLinkRclRep(config,
|
||||||
|
"compressedfilemaxkbs"));
|
||||||
|
ConfParamIntW *ezfmaxkbs = new
|
||||||
|
ConfParamIntW(m_groupbox, lnkzfmaxkbs,
|
||||||
|
tr("Max. compressed file size (KB)"),
|
||||||
|
tr("This value sets a threshold beyond which compressed"
|
||||||
|
"files will not be processed. Set to -1 for no "
|
||||||
|
"limit, to 0 for no decompression ever."),
|
||||||
|
-1, 1000000);
|
||||||
|
m_widgets.push_back(ezfmaxkbs);
|
||||||
|
|
||||||
vboxLayout->addWidget(m_groupbox);
|
vboxLayout->addWidget(m_groupbox);
|
||||||
subDirChanged();
|
subDirChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,12 @@ usesystemfilecommand = 1
|
|||||||
# know? (we can otherwise just ignore them)
|
# know? (we can otherwise just ignore them)
|
||||||
indexallfilenames = 1
|
indexallfilenames = 1
|
||||||
|
|
||||||
|
# Size limit for compressed files. We need to decompress these in a
|
||||||
|
# temporary directory for identification, which can be wasteful in some
|
||||||
|
# cases. Limit the waste. Negative means no limit. 0 results in no
|
||||||
|
# processing of any compressed file
|
||||||
|
# compressedfilemaxkbs = -1
|
||||||
|
|
||||||
# Length of abstracts we store while indexing. Longer will make for a
|
# Length of abstracts we store while indexing. Longer will make for a
|
||||||
# bigger db
|
# bigger db
|
||||||
# idxabsmlen = 250
|
# idxabsmlen = 250
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user