mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-08 11:25:51 +08:00
github_utils: use exact-match ref lookup in get_bucket_sha (#37813)
The plural `git/refs/heads/{bucket}` endpoint does prefix matching
and returns a list when multiple refs share the prefix, which makes
`r.json()['object']` raise TypeError. Switch to the singular
`git/ref/heads/{bucket}` endpoint so we only match the exact bucket
and get a clean 404 otherwise.
This commit is contained in:
@@ -62,7 +62,7 @@ class GithubUtils:
|
||||
self.api_call(github_path, data=data, method=HTTPMethod.POST, data_call=True)
|
||||
|
||||
def get_bucket_sha(self, bucket):
|
||||
github_path = f"git/refs/heads/{bucket}"
|
||||
github_path = f"git/ref/heads/{bucket}"
|
||||
r = self.api_call(github_path, data_call=True, raise_on_failure=False)
|
||||
return r.json()['object']['sha'] if r.ok else None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user