GUI: a temporary file was wrongly created when mimeview specified to open the parent (%F) and it happened to be a regular file

This commit is contained in:
Jean-Francois Dockes 2022-06-14 14:54:41 +02:00
parent 6575476d47
commit 5325c0a533

View File

@ -332,11 +332,14 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString qterm)
LOGDEB("StartNativeViewer: groksipath " << groksipath << " wantsf " <<
wantsfile << " wantsparentf " << wantsparentfile << "\n");
bool wantedfile_doc_has_ipath =
(wantsfile && !doc.ipath.empty()) || (wantsparentfile && !pdoc.ipath.empty());
// If the command wants a file but this is not a file url, or
// there is an ipath that it won't understand, we need a temp file:
theconfig->setKeyDir(fn.empty() ? "" : path_getfather(fn));
if (((wantsfile || wantsparentfile) && fn.empty()) ||
(!groksipath && !doc.ipath.empty()) ) {
(!groksipath && wantedfile_doc_has_ipath) ) {
TempFile temp;
Rcl::Doc& thedoc = wantsparentfile ? pdoc : doc;
if (!FileInterner::idocToFile(temp, string(), theconfig, thedoc)) {