@@ -179,15 +179,18 @@ def get_locations(objects):
179179 try :
180180 with urllib .request .urlopen (req , timeout = TIMEOUT ) as resp :
181181 data = json .load (resp )
182+ assert len (data ["objects" ]) == len (
183+ indexes
184+ ), f"received { len (data )} objects, expected { len (indexes )} "
185+ for i , resp in zip (indexes , data ["objects" ]):
186+ ret [i ] = f'{ resp ["oid" ]} { resp ["actions" ]["download" ]["href" ]} '
187+ return ret
182188 except urllib .error .URLError as e :
183189 warn (f"encountered { type (e ).__name__ } { e } , ignoring endpoint { endpoint .name } " )
184190 continue
185- assert len (data ["objects" ]) == len (
186- indexes
187- ), f"received { len (data )} objects, expected { len (indexes )} "
188- for i , resp in zip (indexes , data ["objects" ]):
189- ret [i ] = f'{ resp ["oid" ]} { resp ["actions" ]["download" ]["href" ]} '
190- return ret
191+ except KeyError :
192+ warn (f"encountered malformed response, ignoring endpoint { endpoint .name } :\n { json .dumps (data , indent = 2 )} " )
193+ continue
191194 raise NoEndpointsFound
192195
193196
@@ -210,5 +213,12 @@ def get_lfs_object(path):
210213 for resp in get_locations (objects ):
211214 print (resp )
212215except NoEndpointsFound as e :
213- print (f"ERROR: no valid endpoints found" , file = sys .stderr )
216+ print ("""\
217+ ERROR: no valid endpoints found, your git authentication method might be currently unsupported by this script.
218+ You can bypass this error by running from semmle-code (this might take a while):
219+ git config lfs.fetchexclude ""
220+ git -C ql config lfs.fetchinclude \\ *
221+ git lfs fetch && git lfs checkout
222+ cd ql
223+ git lfs fetch && git lfs checkout""" , file = sys .stderr )
214224 sys .exit (1 )
0 commit comments