[arch] fix: exception when trying to retrieve the PKGBUILD of a package without a base defined (info)

This commit is contained in:
Vinicius Moreira
2022-03-12 11:02:16 -03:00
parent c003d0406c
commit 3edacd75f4
2 changed files with 10 additions and 3 deletions

View File

@@ -69,6 +69,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- AppImage - AppImage
- info: displaying attributes related to the installation after the application has been removed (search) - info: displaying attributes related to the installation after the application has been removed (search)
- Arch:
- AUR:
- info: exception when trying to retrieve the PKGBUILD of a package without a base defined
- UI - UI
- some package icons would not appear if there is no URL associated with them - some package icons would not appear if there is no URL associated with them

View File

@@ -71,10 +71,13 @@ class AURDataMapper:
with open(cached_pkgbuild) as f: with open(cached_pkgbuild) as f:
pkg.pkgbuild = f.read() pkg.pkgbuild = f.read()
else: else:
res = self.http_client.get(pkg.get_pkg_build_url()) url = pkg.get_pkg_build_url()
if res and res.status_code == 200 and res.text: if url:
pkg.pkgbuild = res.text res = self.http_client.get(url)
if res and res.status_code == 200 and res.text:
pkg.pkgbuild = res.text
def map_api_data(self, apidata: dict, pkgs_installed: Optional[dict], categories: dict) -> ArchPackage: def map_api_data(self, apidata: dict, pkgs_installed: Optional[dict], categories: dict) -> ArchPackage:
data = pkgs_installed.get(apidata.get('Name')) if pkgs_installed else None data = pkgs_installed.get(apidata.get('Name')) if pkgs_installed else None