mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
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
This commit is contained in:
parent
de106cf291
commit
dff8093560
|
@ -97,10 +97,9 @@ class GitService(SrhtService):
|
||||||
|
|
||||||
def get_readme(self, user, repo_name, repo_url):
|
def get_readme(self, user, repo_name, repo_url):
|
||||||
# TODO: Cache?
|
# TODO: Cache?
|
||||||
# TODO: Use default branch
|
link_prefix = repo_url + "/blob/HEAD/"
|
||||||
link_prefix = repo_url + "/blob/refs/heads/master/"
|
|
||||||
for readme_name in readme_names:
|
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))
|
headers=get_authorization(user))
|
||||||
if r.status_code == 404:
|
if r.status_code == 404:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue