GitHub: Check asset filename extension instead of content type for better reliability.
This commit is contained in:
parent
141f65c04c
commit
431e6b4311
|
@ -1,5 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
from pathlib import Path
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
from .web import Web
|
from .web import Web
|
||||||
|
@ -28,7 +29,7 @@ class GitHub(Web):
|
||||||
url=f"{cls.api_url}/repos/{repo_owner}/{repo_name}/releases/latest"
|
url=f"{cls.api_url}/repos/{repo_owner}/{repo_name}/releases/latest"
|
||||||
).json()
|
).json()
|
||||||
for asset in latest_release["assets"]:
|
for asset in latest_release["assets"]:
|
||||||
if asset["content_type"] == "application/x-zip-compressed":
|
if Path(asset["name"]).suffix == ".zip":
|
||||||
return super().download(addon, asset["browser_download_url"])
|
return super().download(addon, asset["browser_download_url"])
|
||||||
raise FileNotFoundError("No zip file found for latest release")
|
raise FileNotFoundError("No zip file found for latest release")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue