diff --git a/nix_update/version/gitea.py b/nix_update/version/gitea.py index f4dc63a..f1eac0f 100644 --- a/nix_update/version/gitea.py +++ b/nix_update/version/gitea.py @@ -1,4 +1,5 @@ import json +import re from urllib.parse import ParseResult from urllib.request import urlopen @@ -10,6 +11,7 @@ def fetch_gitea_versions(url: ParseResult) -> list[Version]: return [] _, owner, repo, *_ = url.path.split("/") + repo = re.sub(r"\.git$", "", repo) tags_url = f"https://{url.netloc}/api/v1/repos/{owner}/{repo}/tags" resp = urlopen(tags_url) tags = json.loads(resp.read()) @@ -21,6 +23,7 @@ def fetch_gitea_snapshots(url: ParseResult, branch: str) -> list[Version]: return [] _, owner, repo, *_ = url.path.split("/") + repo = re.sub(r"\.git$", "", repo) commits_url = f"https://{url.netloc}/api/v1/repos/{owner}/{repo}/commits?sha={branch}&limit=1&stat=false&verification=false&files=false" resp = urlopen(commits_url) commits = json.loads(resp.read())