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.
pull/2426/head
d8ahazard 2023-10-30 21:19:52 -05:00
parent e750112612
commit 836dee9204
2 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View File

@ -56,6 +56,7 @@ cache
/log
/cert
.vscode/
.idea/
/localizations
# unexcluded so folders get created

View File

@ -318,9 +318,12 @@ def create_html(search_text, sort_column):
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)