r22225 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Fri Nov 24 15:32:15 UTC 2017


Author: jghali
Date: Fri Nov 24 15:32:15 2017
New Revision: 22225

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22225
Log:
#15050: Scribus 1.5.4svn doesn't open compressed files whose name contains multiple dots

Modified:
    trunk/Scribus/scribus/fileloader.cpp

Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22225&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp	(original)
+++ trunk/Scribus/scribus/fileloader.cpp	Fri Nov 24 15:32:15 2017
@@ -117,55 +117,51 @@
 	int ret = -1;
 	if (!fi.exists())
 		ret = -1;
-	QString ext = fi.completeSuffix().toLower();
+	QString lwrFileName = m_fileName.toLower();
 
 	bool found = false;
 	QList<FileFormat> fileFormats(LoadSavePlugin::supportedFormats());
 	QList<FileFormat>::const_iterator it(fileFormats.constBegin());
 	QList<FileFormat>::const_iterator itEnd(fileFormats.constEnd());
-	for ( ; it != itEnd ; ++it )
-	{
+	for ( ; (it != itEnd) && (!found); ++it)
+	{
+		if (!it->plug)
+			continue;
 		for (int a = 0; a < it->fileExtensions.count(); a++)
 		{
-			QString exts = it->fileExtensions[a].toLower();
-			if (ext == exts)
+			QString ext = it->fileExtensions[a].toLower();
+			if (lwrFileName.endsWith("." + ext)) // Beware of file names containing multiple points
 			{
-				if (it->plug != 0)
+				if (it->plug->fileSupported(0, m_fileName))
+				{
+					ret = it->formatId;
+					found = true;
+					break;
+				}
+			}
+		}
+	}
+	if (!found)
+	{
+	// now try for the last suffix
+		QString ext = fi.suffix().toLower();
+		it = fileFormats.constBegin();
+		itEnd = fileFormats.constEnd();
+		for ( ; (it != itEnd) && (!found); ++it)
+		{
+			if (!it->plug)
+				continue;
+			bool found = false;
+			for (int a = 0; a < it->fileExtensions.count(); a++)
+			{
+				QString exts = it->fileExtensions[a].toLower();
+				if (ext == exts)
 				{
 					if (it->plug->fileSupported(0, m_fileName))
 					{
 						ret = it->formatId;
 						found = true;
 						break;
-					}
-				}
-			}
-		}
-		if (found)
-			break;
-	}
-	if (!found)
-	{
-	// now try for the last suffix
-		ext = fi.suffix().toLower();
-		it = fileFormats.constBegin();
-		itEnd = fileFormats.constEnd();
-		for ( ; it != itEnd ; ++it )
-		{
-			bool found = false;
-			for (int a = 0; a < it->fileExtensions.count(); a++)
-			{
-				QString exts = it->fileExtensions[a].toLower();
-				if (ext == exts)
-				{
-					if (it->plug != 0)
-					{
-						if (it->plug->fileSupported(0, m_fileName))
-						{
-							ret = it->formatId;
-							found = true;
-							break;
-						}
 					}
 				}
 			}




More information about the scribus-commit mailing list