r24039 by jghali - Backport safeguards for #16252 so as to avoid writing temporary scrapbook items to root directory/drive

scribus-commit scribus-commit at lists.scribus.net
Sat Sep 26 18:42:17 UTC 2020


Author: jghali
Date: Sat Sep 26 18:42:16 2020
New Revision: 24039

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24039
Log:
Backport safeguards for #16252 so as to avoid writing temporary scrapbook items to root directory/drive

Modified:
    branches/Version14x/Scribus/scribus/scrapbookpalette.cpp

Modified: branches/Version14x/Scribus/scribus/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24039&path=/branches/Version14x/Scribus/scribus/scrapbookpalette.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scrapbookpalette.cpp	(original)
+++ branches/Version14x/Scribus/scribus/scrapbookpalette.cpp	Sat Sep 26 18:42:16 2020
@@ -1311,9 +1311,14 @@
 
 void Biblio::ObjFromCopyAction(QString text, QString name)
 {
-	QString nam = "";
+	// Something is bad with temp scrapbook directory, either it does not exists
+	// or is unreadeable, do not attempt to create temp scrapbook items in such case,
+	// they may end up in root directory or drive
+	if (tempBView->ScFilename.isEmpty())
+		return;
+
 	QString tmp;
-	nam = name;
+	QString nam = name;
 	if (nam.isEmpty())
 		nam = tr("Object") + tmp.setNum(tempCount);
 	if (tempBView->objectMap.contains(nam))
@@ -1417,7 +1422,12 @@
 
 void Biblio::CleanUpTemp()
 {
-	QMap<QString,BibView::Elem>::Iterator it;
+	// Something is bad with temp scrapbook directory, either it does not exists
+	// or is unreadeable, do not attempt to delete files in such case
+	if (tempBView->ScFilename.isEmpty())
+		return;
+
+	QMap<QString, BibView::Elem>::Iterator it;
 	for (it = tempBView->objectMap.begin(); it != tempBView->objectMap.end(); ++it)
 	{
 		QFile f(it.value().Data);




More information about the scribus-commit mailing list