From c33a377b6afe5ee5cf2d6791d74182b6f0d4a5f0 Mon Sep 17 00:00:00 2001 From: Jules-WinnfieldX Date: Fri, 10 May 2024 20:03:48 -0600 Subject: [PATCH] imgur is a dick, and for some reason not returning proper status' and json anymore. So work around --- cyberdrop_dl/__init__.py | 2 +- cyberdrop_dl/clients/download_client.py | 3 +++ pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py index 0419a93d2..07f0e9e28 100644 --- a/cyberdrop_dl/__init__.py +++ b/cyberdrop_dl/__init__.py @@ -1 +1 @@ -__version__ = "5.3.1" +__version__ = "5.3.2" diff --git a/cyberdrop_dl/clients/download_client.py b/cyberdrop_dl/clients/download_client.py index 43e8eebf4..7a0af5184 100644 --- a/cyberdrop_dl/clients/download_client.py +++ b/cyberdrop_dl/clients/download_client.py @@ -140,6 +140,9 @@ async def _append_content(self, media_item, content: aiohttp.StreamReader, updat await asyncio.sleep(0) await f.write(chunk) await update_progress(len(chunk)) + if not content.total_bytes and not media_item.partial_file.stat().st_size: + media_item.partial_file.unlink() + raise DownloadFailure(status=HTTPStatus.NOT_FOUND, message="File is empty") async def download_file(self, manager: Manager, domain: str, media_item: MediaItem) -> None: """Starts a file""" diff --git a/pyproject.toml b/pyproject.toml index fb613593f..9f48088ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cyberdrop-dl" -version = "5.3.1" +version = "5.3.2" description = "Bulk downloader for multiple file hosts" authors = ["Jules Winnfield "] readme = "README.md"