Unverified Commit 4150ceae authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

fix check for exceeded quota on Google Drive (#3710)

* fix check for exceeded quota on Google Drive

* safeguard quota exceed check
parent 97b6b150
...@@ -175,9 +175,11 @@ def list_files(root: str, suffix: str, prefix: bool = False) -> List[str]: ...@@ -175,9 +175,11 @@ def list_files(root: str, suffix: str, prefix: bool = False) -> List[str]:
def _quota_exceeded(response: "requests.models.Response") -> bool: # type: ignore[name-defined] def _quota_exceeded(response: "requests.models.Response") -> bool: # type: ignore[name-defined]
try:
start = next(response.iter_content(chunk_size=128, decode_unicode=True))
return isinstance(start, str) and "Google Drive - Quota exceeded" in start
except StopIteration:
return False return False
# See https://github.com/pytorch/vision/issues/2992 for details
# return "Google Drive - Quota exceeded" in response.text
def download_file_from_google_drive(file_id: str, root: str, filename: Optional[str] = None, md5: Optional[str] = None): def download_file_from_google_drive(file_id: str, root: str, filename: Optional[str] = None, md5: Optional[str] = None):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment