aports/testing/ovos-skill-manager/fix-github-main-branch-detection.patch

32 lines
1.1 KiB
Diff

From 466f081c14bc889c61967bd9f3e66e7a53de3a07 Mon Sep 17 00:00:00 2001
From: Sertonix <sertonix@posteo.net>
Date: Thu, 28 Mar 2024 11:00:15 +0100
Subject: [PATCH] fix github main branch detection
---
ovos_skills_manager/github/raw.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/ovos_skills_manager/github/raw.py b/ovos_skills_manager/github/raw.py
index a0a2a42..c7c7805 100644
--- a/ovos_skills_manager/github/raw.py
+++ b/ovos_skills_manager/github/raw.py
@@ -46,12 +46,11 @@ def get_main_branch_from_github_url(url: str) -> str:
"""
html = None
try:
- url = normalize_github_url(url)
+ url = normalize_github_url(url) + "/branches"
html = requests.get(url).text
if "<title>Rate limit &middot; GitHub</title>" in html:
raise GithubHTTPRateLimited
- encoded = html.split("default-branch=\"")[1].split('"')[0]
- return base64.b64decode(encoded).decode("utf-8")
+ return html.split('id="default"')[1].split('title="')[1].split('"')[0]
except Exception as e:
LOG.error(f"html={html}")
LOG.error(e)
--
2.44.0