From 5325c0a5330270ce7ab0de9f9bf894b02dd35991 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 14 Jun 2022 14:54:41 +0200 Subject: [PATCH] GUI: a temporary file was wrongly created when mimeview specified to open the parent (%F) and it happened to be a regular file --- src/qtgui/rclm_view.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qtgui/rclm_view.cpp b/src/qtgui/rclm_view.cpp index a8023b9e..10aa360d 100644 --- a/src/qtgui/rclm_view.cpp +++ b/src/qtgui/rclm_view.cpp @@ -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)) {