Github: Prefer classic version of released files.

This commit is contained in:
Casper V. Kristensen 2021-03-24 11:33:48 +01:00
parent f44712e53c
commit 1445f7d26e
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -28,7 +28,7 @@ class GitHub(Web):
latest_release = http.open(
url=f"{cls.api_url}/repos/{repo_owner}/{repo_name}/releases/latest"
).json()
for asset in latest_release["assets"]:
for asset in sorted(latest_release["assets"], key=lambda a: "classic" in a["name"].lower(), reverse=True):
if Path(asset["name"]).suffix == ".zip":
return super().download(addon, asset["browser_download_url"])
raise FileNotFoundError("No zip file found for latest release")