@@ -381,8 +381,11 @@ async def async_download_webtoon(self) -> None:
381381 canceled_tasks += task .cancel ()
382382
383383 extras : dict = dict ()
384- if thumbnail_task and not self .skip_thumbnail_download and not thumbnail_task .cancel ():
385- extras ["thumbnail_path" ] = await thumbnail_task
384+ if thumbnail_task :
385+ if isinstance (thumbnail_task , Path ):
386+ extras ["thumbnail_path" ] = thumbnail_task
387+ elif not self .skip_thumbnail_download and not thumbnail_task .cancel ():
388+ extras ["thumbnail_path" ] = await thumbnail_task
386389 self ._download_status = "nothing"
387390 context .update (exc = exc , extras = extras , canceled = canceled_tasks , is_successful = False )
388391 raise
@@ -392,8 +395,11 @@ async def async_download_webtoon(self) -> None:
392395 await self ._tasks .join ()
393396 self ._download_status = "nothing"
394397 extras : dict = dict ()
395- if thumbnail_task and not self .skip_thumbnail_download :
396- extras ["thumbnail_path" ] = await thumbnail_task
398+ if thumbnail_task :
399+ if isinstance (thumbnail_task , Path ):
400+ extras ["thumbnail_path" ] = thumbnail_task
401+ elif not self .skip_thumbnail_download :
402+ extras ["thumbnail_path" ] = await thumbnail_task
397403 context .update (exc = None , extras = extras )
398404
399405 async def fetch_all (self , reload : bool = False ) -> None :
@@ -881,7 +887,7 @@ def _cookie_get(cookie: str | None, key: str) -> str | None:
881887 return result if result is None else result .value
882888 # return {key: morsel.value for key, morsel in parsed.items()}
883889
884- async def _download_thumbnail (self ) -> None | asyncio .Task [Path | None ]:
890+ async def _download_thumbnail (self ) -> None | Path | asyncio .Task [Path | None ]:
885891 if self .skip_thumbnail_download :
886892 return None
887893
@@ -897,8 +903,9 @@ async def _download_thumbnail(self) -> None | asyncio.Task[Path | None]:
897903 # 중복된 컨텐츠가 나타날 수도 있지만 상관없음
898904 contents += snapshot_contents
899905
900- if any (content .startswith ("thumbnail." ) for content in contents ):
901- return None
906+ for content in contents :
907+ if content .startswith ("thumbnail." ):
908+ return webtoon_directory / content
902909
903910 async with self .callbacks .context ("download_thumbnail" ):
904911 return asyncio .create_task (self ._download_image (self .webtoon_thumbnail_url , webtoon_directory , "thumbnail" ))
0 commit comments