From 0fbed2fce8a1e042f9bd9ad42b3d25ebfd2b8760 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..5e44c86b 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( + ( + "Found no main source and the last source was not " + "external in %s. Not updating appdata" + ), + self._root_manifest_path, + ) + return last_update = selected_data.new_version