From 4c9ca22b43637db12670ff70003cc168c58a4123 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 13 Apr 2022 14:34:52 -0300 Subject: [PATCH] [flatpak] fix: random index out of bounds exception when reading updates --- CHANGELOG.md | 1 + bauh/gems/flatpak/flatpak.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3afe7621..e04388a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - some updates or download sizes not being displayed when there are new required runtimes for installed Flatpaks - not displaying new required runtimes as updates (requires Flatpak >= 1.12) - upgrade: informing the download size as the additional installation size + - random index out of bounds exception when reading updates - UI - not displaying the right unit symbol for byte based sizes (kB, MB, TB, ...) [#250](https://github.com/vinifmor/bauh/issues/250) diff --git a/bauh/gems/flatpak/flatpak.py b/bauh/gems/flatpak/flatpak.py index e656fc56..87ac1424 100755 --- a/bauh/gems/flatpak/flatpak.py +++ b/bauh/gems/flatpak/flatpak.py @@ -247,11 +247,18 @@ def fill_updates(version: Version, installation: str, res: Dict[str, Set[str]]): if o: line_split = o.decode().strip().split('\t') - if len(line_split) > 2: + if len(line_split) >= 5: if version >= VERSION_1_5: - update_id = f'{line_split[2]}/{line_split[3]}/{installation}/{line_split[5]}' + update_id = f'{line_split[2]}/{line_split[3]}/{installation}' + + if len(line_split) >= 6: + update_id = f'{update_id}/{line_split[5]}' + elif version >= VERSION_1_2: - update_id = f'{line_split[2]}/{line_split[4]}/{installation}/{line_split[5]}' + update_id = f'{line_split[2]}/{line_split[4]}/{installation}' + + if len(line_split) >= 6: + update_id = f'{update_id}/{line_split[5]}' else: update_id = f'{line_split[2]}/{line_split[4]}/{installation}'