From dff809356043771182f3f84c3fc9fea5d3ba1f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 17 Aug 2020 19:07:06 +0200 Subject: [PATCH] Use default branch for querying README blobs GETting "{_gitsrht}/api/repos/{repo_name}/refdb/HEAD" would also have worked, but it's hardly necessary Ref: ~sircmpwn/hub.sr.ht#50 --- hubsrht/services.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hubsrht/services.py b/hubsrht/services.py index d0e3576..0945bf4 100644 --- a/hubsrht/services.py +++ b/hubsrht/services.py @@ -97,10 +97,9 @@ class GitService(SrhtService): def get_readme(self, user, repo_name, repo_url): # TODO: Cache? - # TODO: Use default branch - link_prefix = repo_url + "/blob/refs/heads/master/" + link_prefix = repo_url + "/blob/HEAD/" for readme_name in readme_names: - r = self.session.get(f"{_gitsrht}/api/repos/{repo_name}/blob/master/{readme_name}", + r = self.session.get(f"{_gitsrht}/api/repos/{repo_name}/blob/HEAD/{readme_name}", headers=get_authorization(user)) if r.status_code == 404: continue