From cdabbc183267870feed0d4e8c7938274cac134d2 Mon Sep 17 00:00:00 2001 From: bbhtt Date: Fri, 31 May 2024 20:40:42 +0530 Subject: [PATCH] manifest: Skip updating appdata if last source is not external or no main source is found Closes https://github.com/flathub-infra/flatpak-external-data-checker/issues/346 --- src/manifest.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/manifest.py b/src/manifest.py index f244e28a..6e3a1768 100644 --- a/src/manifest.py +++ b/src/manifest.py @@ -486,10 +486,19 @@ def _update_appdata(self): elif data.source_path == self._root_manifest_path: selected_data = data else: - # Guess that the last external source in the root manifest is the one - # corresponding to the main application bundle. - assert selected_data is not None - log.warning("Guessed upstream source: %s", selected_data) + if selected_data is not None: + # Guess that the last external source in the root manifest is the one + # corresponding to the main application bundle. + log.warning("Guessed last source as main source: %s", selected_data) + else: + log.error( + ( + "No main source configured and no external source in " + "%s. Not updating appdata" + ), + self._root_manifest_path, + ) + return last_update = selected_data.new_version