From dc4cf3db2c7382f1b839f1e1a9052ed94fd4e009 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Wed, 19 Jan 2022 02:19:28 +0100 Subject: [PATCH] Fix AppImage validation with custom update information --- src/updater.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/updater.cpp b/src/updater.cpp index e9db515..0de4a36 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -71,17 +71,20 @@ namespace appimage::update { } void validateAppImage() { - const auto rawUpdateInformationFromAppImage = appImage.readRawUpdateInformation(); - // first check whether there's update information at all - if (rawUpdateInformationFromAppImage.empty()) { - std::ostringstream oss; - oss << "Could not find update information in the AppImage. " + // note that we skip this check when custom update information is set intentionally + if (this->rawUpdateInformation.empty()) { + const auto rawUpdateInformationFromAppImage = appImage.readRawUpdateInformation(); + + if (rawUpdateInformationFromAppImage.empty()) { + std::ostringstream oss; + oss << "Could not find update information in the AppImage. " << "Please contact the author of the AppImage and ask them to embed update information."; - throw AppImageError(oss.str()); + throw AppImageError(oss.str()); + } } - const auto updateInformationPtr = makeUpdateInformation(rawUpdateInformationFromAppImage); + const auto updateInformationPtr = makeUpdateInformation(rawUpdateInformation); const auto zsyncUrl = updateInformationPtr->buildUrl(makeIssueStatusMessageCallback()); // now check whether a ZSync URL could be composed by readAppImage