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: 6163dd5ca06efe05a7d4645f6b4127847ce133ac
This commit is contained in:
Shane Smiskol
2022-05-09 13:31:55 -07:00
committed by GitHub
parent d4d72ab938
commit cf0c8aac08

View File

@@ -87,6 +87,7 @@ class URLFile:
file_begin = self._pos
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
position = (file_begin // CHUNK_SIZE) * CHUNK_SIZE
response = b""