Switch to unified view

a/src/internfile/mh_exec.cpp b/src/internfile/mh_exec.cpp
...
...
12
 *   You should have received a copy of the GNU General Public License
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program; if not, write to the
13
 *   along with this program; if not, write to the
14
 *   Free Software Foundation, Inc.,
14
 *   Free Software Foundation, Inc.,
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
17
#include "cstr.h"
18
#include "execmd.h"
18
#include "execmd.h"
19
#include "mh_exec.h"
19
#include "mh_exec.h"
20
#include "mh_html.h"
20
#include "mh_html.h"
21
#include "debuglog.h"
21
#include "debuglog.h"
22
#include "cancelcheck.h"
22
#include "cancelcheck.h"
...
...
93
    myparams.push_back(m_fn);
93
    myparams.push_back(m_fn);
94
    if (!m_ipath.empty())
94
    if (!m_ipath.empty())
95
    myparams.push_back(m_ipath);
95
    myparams.push_back(m_ipath);
96
96
97
    // Execute command, store the output
97
    // Execute command, store the output
98
    string& output = m_metaData["content"];
98
    string& output = m_metaData[cstr_content];
99
    output.erase();
99
    output.erase();
100
    ExecCmd mexec;
100
    ExecCmd mexec;
101
    MEAdv adv(filtermaxseconds);
101
    MEAdv adv(filtermaxseconds);
102
    mexec.setAdvise(&adv);
102
    mexec.setAdvise(&adv);
103
    mexec.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
103
    mexec.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
...
...
144
    return true;
144
    return true;
145
}
145
}
146
146
147
void MimeHandlerExec::finaldetails()
147
void MimeHandlerExec::finaldetails()
148
{
148
{
149
    string& output = m_metaData["content"];
149
    string& output = m_metaData[cstr_content];
150
150
151
    // If output is text/plain (not text/html), we may have to convert
151
    // If output is text/plain (not text/html), we may have to convert
152
    // it to utf-8, because this is the last point where it can be done.
152
    // it to utf-8, because this is the last point where it can be done.
153
    // cfgFilterOutputCharset comes from the mimeconf filter definition line
153
    // cfgFilterOutputCharset comes from the mimeconf filter definition line
154
    string charset = cfgFilterOutputCharset.empty() ? "utf-8" : 
154
    string charset = cfgFilterOutputCharset.empty() ? "utf-8" : 
...
...
156
    if (!stringlowercmp("default", charset)) {
156
    if (!stringlowercmp("default", charset)) {
157
    charset = m_dfltInputCharset;
157
    charset = m_dfltInputCharset;
158
    }
158
    }
159
    string mt = cfgFilterOutputMtype.empty() ? "text/html" : 
159
    string mt = cfgFilterOutputMtype.empty() ? "text/html" : 
160
    cfgFilterOutputMtype;
160
    cfgFilterOutputMtype;
161
    if (!mt.compare("text/plain") && stringlowercmp("utf-8", charset)) {
161
    if (!mt.compare(cstr_textplain) && stringlowercmp("utf-8", charset)) {
162
    string transcoded;
162
    string transcoded;
163
    int ecnt;
163
    int ecnt;
164
    if (!transcode(output, transcoded, charset, "UTF-8", &ecnt)) {
164
    if (!transcode(output, transcoded, charset, "UTF-8", &ecnt)) {
165
        LOGERR(("mh_exec: transcode failed from [%s] to UTF-8\n",
165
        LOGERR(("mh_exec: transcode failed from [%s] to UTF-8\n",
166
            charset.c_str()));
166
            charset.c_str()));
...
...
181
    m_metaData["origcharset"] = m_dfltInputCharset;
181
    m_metaData["origcharset"] = m_dfltInputCharset;
182
182
183
    // Supposed contents charset encoding. This could still be
183
    // Supposed contents charset encoding. This could still be
184
    // overridden by the content-type meta tag for html, but this is
184
    // overridden by the content-type meta tag for html, but this is
185
    // wasteful so we hope it's correct
185
    // wasteful so we hope it's correct
186
    m_metaData["charset"] = charset;
186
    m_metaData[cstr_charset] = charset;
187
    m_metaData["mimetype"] = mt;
187
    m_metaData[cstr_mimetype] = mt;
188
188
189
    string md5, xmd5, reason;
189
    string md5, xmd5, reason;
190
    if (MD5File(m_fn, md5, &reason)) {
190
    if (MD5File(m_fn, md5, &reason)) {
191
    m_metaData["md5"] = MD5HexPrint(md5, xmd5);
191
    m_metaData["md5"] = MD5HexPrint(md5, xmd5);
192
    } else {
192
    } else {