mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 21:44:16 +02:00
[debian] fix: crashing when parsing the package size attributes with unexpected symbols (info dialog)
This commit is contained in:
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [0.10.2]
|
||||
|
||||
### Fixes
|
||||
- Debian
|
||||
- info: crashing when the package size has unexpected symbols [#251](https://github.com/vinifmor/bauh/issues/251)
|
||||
|
||||
## [0.10.1] 2022-03-31
|
||||
|
||||
### Features
|
||||
|
||||
@@ -72,9 +72,14 @@ class Aptitude:
|
||||
size_split = final_val.split(' ')
|
||||
|
||||
if len(size_split) >= 1:
|
||||
number = float(size_split[0].replace(',', '.'))
|
||||
measure = size_split[1].strip().lower() if len(size_split) >= 2 else 'b'
|
||||
final_val = size_to_byte(number, measure)
|
||||
try:
|
||||
number = float(size_split[0].replace(',', '.'))
|
||||
measure = size_split[1].strip().lower() if len(size_split) >= 2 else 'b'
|
||||
final_val = size_to_byte(number, measure)
|
||||
except ValueError:
|
||||
self._log.warning(f"Could not parse the attribute '{final_field}' "
|
||||
f"value {final_val} to float")
|
||||
final_val = None
|
||||
else:
|
||||
self._log.warning(f"Unhandled value ({val}) for attribute '{field}'")
|
||||
final_val = None
|
||||
|
||||
Reference in New Issue
Block a user