From 01c663b692da97bbc8b9bac8269656e6c8462efa Mon Sep 17 00:00:00 2001 From: Guy Scharf Date: Tue, 21 Jul 2020 13:50:06 -0700 Subject: [PATCH] Check for invalid version strings in versions.xml; fix display problem; update release notes for Phil --- Htmldocs/release_notes.html | 1 + oscar/checkupdates.cpp | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Htmldocs/release_notes.html b/Htmldocs/release_notes.html index 35e82f38..e122f54d 100644 --- a/Htmldocs/release_notes.html +++ b/Htmldocs/release_notes.html @@ -26,6 +26,7 @@
  • [fix] Adjust font size and column widths on Statistics page.
  • [fix] Improve language in various error messages.
  • [fix] Date at right end of Overview page reflects actual data, not any future notes.
  • +
  • [fix] Limit SD card scan to mounted vfat volumes.
  • Changes and fixes in OSCAR v1.1.1 diff --git a/oscar/checkupdates.cpp b/oscar/checkupdates.cpp index 96270fb1..ccf8830f 100644 --- a/oscar/checkupdates.cpp +++ b/oscar/checkupdates.cpp @@ -64,7 +64,6 @@ QString platformStr() return platform; } -//static const QString OSCAR_Version_File = "http://www.guyscharf.com/VERSION/versions.xml"; static const QString OSCAR_Version_File = "http://www.sleepfiles.com/OSCAR/versions/versions.xml"; static QString versionXML; @@ -90,7 +89,6 @@ QString readLocalVersions() { return QString(); } return QString(qba).toLower(); - } /*! \fn GetVersionInfo @@ -124,8 +122,13 @@ VersionInfo getVersionInfo (QString type, QString platform) { //qDebug() << "expecting version or notes, read" << reader.name(); if (reader.name() == "version") { QString fileVersion = reader.readElementText(); - if (Version(fileVersion) > getVersion()) - foundInfo.version = fileVersion; // We found a more recent version + Version fv(fileVersion); + if (!fv.IsValid()) { + qWarning() << "Server file versions.xml contains an invalid version code" << fileVersion; + } else { + if (fv > getVersion()) + foundInfo.version = fileVersion; // We found a more recent version + } } else if (reader.name() == "notes") { foundInfo.notes = reader.readElementText(); @@ -145,7 +148,7 @@ VersionInfo getVersionInfo (QString type, QString platform) { } } else { - qWarning() << "Versions file improperly formed --" << reader.errorString(); + qWarning() << "Versions.xml file improperly formed --" << reader.errorString(); reader.raiseError(QObject::tr("New versions file improperly formed")); } } @@ -158,9 +161,12 @@ void CheckUpdates::compareVersions () { VersionInfo releaseVersion = getVersionInfo ("release", platformStr()); VersionInfo testVersion = getVersionInfo ("test", platformStr()); - if (testVersion.version.length() == 0 && releaseVersion.version.length() == 0 && showIfCurrent) + msg = ""; + + if (testVersion.version.length() == 0 && releaseVersion.version.length() == 0) { + if (showIfCurrent) msg = QObject::tr("You are running the latest release of OSCAR"); - else { + } else { msg = QObject::tr("A more recent version of OSCAR is available"); msg += "

    " + QObject::tr("You are running version %1").arg(getVersion()) + "

    "; if (releaseVersion.version.length() > 0) {