Skip to content

Commit

Permalink
Fix potential issues parsing extension repo URLs
Browse files Browse the repository at this point in the history
If a repo URL has git@github... in it, the author parsing will fail and the app will crash.
  • Loading branch information
d8ahazard committed Oct 31, 2023
1 parent e750112 commit 836dee9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ cache
/log
/cert
.vscode/
.idea/
/localizations

# unexcluded so folders get created
Expand Down
7 changes: 5 additions & 2 deletions modules/ui_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 836dee9

Please sign in to comment.