[LyX/master] Do not change bibliography processor to default if it is not found

Juergen Spitzmueller spitz at lyx.org
Sun Oct 17 14:52:50 UTC 2021


commit 354362618280c8f80603672e06b650ac557b3837
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Oct 17 11:30:24 2021 +0200

    Do not change bibliography processor to default if it is not found
    
    Rather than that, keep it with a warning that it is not available.
    Fallback procedure (which maintains security measures) is done in
    the conversion step.
    
    This prevents document properties being silently changed on sharing.
---
 src/frontends/qt/GuiDocument.cpp |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 42795bb..5a4584e 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -3993,17 +3993,17 @@ void GuiDocument::paramsToDialog()
 	string options =
 		split(bp_.bibtex_command, command, ' ');
 
-	int const bpos = biblioModule->bibtexCO->findData(toqstr(command));
-	if (bpos != -1) {
-		biblioModule->bibtexCO->setCurrentIndex(bpos);
-		biblioModule->bibtexOptionsLE->setText(toqstr(options).trimmed());
-	} else {
-		// We reset to default if we do not know the specified compiler
-		// This is for security reasons
-		biblioModule->bibtexCO->setCurrentIndex(
-			biblioModule->bibtexCO->findData(toqstr("default")));
-		biblioModule->bibtexOptionsLE->clear();
+	int bpos = biblioModule->bibtexCO->findData(toqstr(command));
+	if (bpos == -1) {
+		// We add and set the unknown compiler, indicating that it is unavailable
+		// to assure document compilation and for security reasons, a fallback
+		// will be used on document processing stage
+		biblioModule->bibtexCO->addItem(toqstr(bformat(_("%1$s (not available)"),
+							from_utf8(command))), toqstr(command));
+		bpos = biblioModule->bibtexCO->findData(toqstr(command));
 	}
+	biblioModule->bibtexCO->setCurrentIndex(bpos);
+	biblioModule->bibtexOptionsLE->setText(toqstr(options).trimmed());
 	biblioModule->bibtexOptionsLE->setEnabled(
 		biblioModule->bibtexCO->currentIndex() != 0);
 


More information about the lyx-cvs mailing list