Skip to content

Commit

Permalink
Fix AppImage validation with custom update information
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Jan 19, 2022
1 parent 0af5a59 commit dc4cf3d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc4cf3d

Please sign in to comment.