@@ -179,15 +179,18 @@ def get_locations(objects):
179
179
try :
180
180
with urllib .request .urlopen (req , timeout = TIMEOUT ) as resp :
181
181
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
182
188
except urllib .error .URLError as e :
183
189
warn (f"encountered { type (e ).__name__ } { e } , ignoring endpoint { endpoint .name } " )
184
190
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
191
194
raise NoEndpointsFound
192
195
193
196
@@ -210,5 +213,12 @@ def get_lfs_object(path):
210
213
for resp in get_locations (objects ):
211
214
print (resp )
212
215
except 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 )
214
224
sys .exit (1 )
0 commit comments