URLFile: raise exception if remote URL doesn't exist when using cache (#24432)

* URLFile returns empty bytes if using cache and remote file doesn't exist

* better exception

* assert on cached files
old-commit-hash: 6163dd5ca0
taco
Shane Smiskol 3 years ago committed by GitHub
parent d4d72ab938
commit cf0c8aac08
  1. 1
      tools/lib/url_file.py

@ -87,6 +87,7 @@ class URLFile:
file_begin = self._pos file_begin = self._pos
file_end = self._pos + ll if ll is not None else self.get_length() file_end = self._pos + ll if ll is not None else self.get_length()
assert file_end != -1, f"Remote file is empty or doesn't exist: {self._url}"
# We have to align with chunks we store. Position is the begginiing of the latest chunk that starts before or at our file # We have to align with chunks we store. Position is the begginiing of the latest chunk that starts before or at our file
position = (file_begin // CHUNK_SIZE) * CHUNK_SIZE position = (file_begin // CHUNK_SIZE) * CHUNK_SIZE
response = b"" response = b""

Loading…
Cancel
Save