From 836dee920477e5b449b34a0df947a0536f2afbad Mon Sep 17 00:00:00 2001 From: d8ahazard Date: Mon, 30 Oct 2023 21:19:52 -0500 Subject: [PATCH] Fix potential issues parsing extension repo URLs If a repo URL has git@github... in it, the author parsing will fail and the app will crash. --- .gitignore | 1 + modules/ui_extensions.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 362e9c257..fb754c657 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ cache /log /cert .vscode/ +.idea/ /localizations # unexcluded so folders get created diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 3f5e69b85..975c8476f 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -318,9 +318,12 @@ def dt(x: str): stats = { 'processed': 0, 'enabled': 0, 'hidden': 0, 'installed': 0 } for ext in sorted(extensions_list, key=sort_function, reverse=sort_reverse): installed = get_installed(ext) - author = f"Author: {ext['url'].split('/')[3]}" if 'github' in ext['url'] else '' + author = '' try: - updated = datetime.timestamp(datetime.fromisoformat(ext.get('updated', '2000-01-01T00:00:00.000Z').rstrip('Z'))) + if 'github' in ext_url: + author = ext_url.split('/')[-2].split(':')[-1] if '/' in ext_url else ext_url.split(':')[1].split('/')[0] + author = f"Author: {author}" + updated = datetime.timestamp(datetime.fromisoformat(ext.get('updated', '2000-01-01T00:00:00.000Z').rstrip('Z'))) except Exception: updated = datetime.timestamp(datetime.now()) update_available = (installed is not None) and (ext['remote'] is not None) and (ext['commit_date'] + 60 * 60 < updated)