diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c77f449..87bfb355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - not displaying all packages that must be uninstalled - displaying "required size" for packages that must be uninstalled - some conflict resolution scenarios when upgrading several packages +- Flatpak + - downgrading crashing with version 1.8.X + - history: the top commit is returned as "(null)" - UI - crashing when nothing can be upgraded diff --git a/bauh/gems/flatpak/controller.py b/bauh/gems/flatpak/controller.py index 0f79781e..cd0e41a5 100644 --- a/bauh/gems/flatpak/controller.py +++ b/bauh/gems/flatpak/controller.py @@ -180,7 +180,13 @@ class FlatpakManager(SoftwareManager): if commits is None: return False - commit_idx = commits.index(pkg.commit) + try: + commit_idx = commits.index(pkg.commit) + except ValueError: + if commits[0] == '(null)': + commit_idx = 0 + else: + return False # downgrade is not possible if the app current commit in the first one: if commit_idx == len(commits) - 1: @@ -301,13 +307,19 @@ class FlatpakManager(SoftwareManager): def get_history(self, pkg: FlatpakApplication) -> PackageHistory: pkg.commit = flatpak.get_commit(pkg.id, pkg.branch, pkg.installation) commits = flatpak.get_app_commits_data(pkg.ref, pkg.origin, pkg.installation) + status_idx = 0 + commit_found = False for idx, data in enumerate(commits): if data['commit'] == pkg.commit: status_idx = idx + commit_found = True break + if not commit_found and pkg.commit and commits[0]['commit'] == '(null)': + commits[0]['commit'] = pkg.commit + return PackageHistory(pkg=pkg, history=commits, pkg_status_idx=status_idx) def _make_exports_dir(self, watcher: ProcessWatcher) -> bool: