mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Bazel: skip git lfs endpoints presenting malformed data
This commit is contained in:
@@ -179,15 +179,18 @@ def get_locations(objects):
|
|||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
|
with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
|
||||||
data = json.load(resp)
|
data = json.load(resp)
|
||||||
|
assert len(data["objects"]) == len(
|
||||||
|
indexes
|
||||||
|
), f"received {len(data)} objects, expected {len(indexes)}"
|
||||||
|
for i, resp in zip(indexes, data["objects"]):
|
||||||
|
ret[i] = f'{resp["oid"]} {resp["actions"]["download"]["href"]}'
|
||||||
|
return ret
|
||||||
except urllib.error.URLError as e:
|
except urllib.error.URLError as e:
|
||||||
warn(f"encountered {type(e).__name__} {e}, ignoring endpoint {endpoint.name}")
|
warn(f"encountered {type(e).__name__} {e}, ignoring endpoint {endpoint.name}")
|
||||||
continue
|
continue
|
||||||
assert len(data["objects"]) == len(
|
except KeyError:
|
||||||
indexes
|
warn(f"encountered malformed response, ignoring endpoint {endpoint.name}:\n{json.dumps(data, indent=2)}")
|
||||||
), f"received {len(data)} objects, expected {len(indexes)}"
|
continue
|
||||||
for i, resp in zip(indexes, data["objects"]):
|
|
||||||
ret[i] = f'{resp["oid"]} {resp["actions"]["download"]["href"]}'
|
|
||||||
return ret
|
|
||||||
raise NoEndpointsFound
|
raise NoEndpointsFound
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user