preview: use the index idea of the mime type after decompression instead or re-running mimetype(). This will fix preview for compressed man pages (which were identified as text/troff after decomp because not under man/

This commit is contained in:
Jean-Francois Dockes 2011-06-22 16:09:55 +02:00
parent c6acfaa766
commit ce44c0a875

View File

@ -250,10 +250,20 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
LOGDEB1(("FileInterner:: after ucomp: m_tdir %s, tfile %s\n",
m_tdir.dirname(), 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)
// Now identify the decompressed file.
if ((flags & FIF_forPreview) && imime) {
// In preview mode, trust the input parameter. The
// file type may depend on the location, ie, for
// .1->text/man, and we just moved the file, so
// we'd be wrong to use mimetype().
l_mime = *imime;
} else {
// 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(("FileInterner:: %s over size limit %d kbs\n",
m_fn.c_str(), maxkbs));