r18058 by jghali - #11279: Image links get corrupted when symlinks involved
scribus-commit
scribus-commit at lists.scribus.net
Sun Jan 6 15:11:38 UTC 2013
Author: jghali
Date: Sun Jan 6 15:11:38 2013
New Revision: 18058
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18058
Log:
#11279: Image links get corrupted when symlinks involved
Modified:
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18058&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Sun Jan 6 15:11:38 2013
@@ -159,8 +159,15 @@
bool Scribus150Format::saveFile(const QString & fileName, const FileFormat & /* fmt */)
{
QString text, tf, tf2, tc, tc2;
+ m_lastSavedFile = "";
+
+ // #11279: Image links get corrupted when symlinks involved
+ // We have to proceed in tow steps here as QFileInfo::canonicalPath()
+ // may no return correct result if fileName does not exists
QString fileDir = QFileInfo(fileName).absolutePath();
- m_lastSavedFile = "";
+ QString canonicalPath = QFileInfo(fileDir).canonicalFilePath();
+ if (!canonicalPath.isEmpty())
+ fileDir = canonicalPath;
// Create a random temporary file name
srand(time(NULL)); // initialize random sequence each time
@@ -174,13 +181,6 @@
}
if (QFile::exists(tmpFileName))
return false;
-
- /*QDomDocument docu("scribus");
- QString st="<SCRIBUSUTF8NEW></SCRIBUSUTF8NEW>";
- docu.setContent(st);
- QDomElement elem=docu.documentElement();
- elem.setAttribute("Version", QString(VERSION));
- QDomElement dc=docu.createElement("DOCUMENT");*/
std::auto_ptr<QIODevice> outputFile;
if (fileName.toLower().right(2) == "gz")
More information about the scribus-commit
mailing list