mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-16 03:55:26 +00:00
🐛 Fix core assets download url empty
This commit is contained in:
parent
4cb540128f
commit
6a989e5d15
@ -47,6 +47,8 @@ class _AssetsService:
|
||||
|
||||
async def _download(self, url: StrOrURL, path: Path, retry: int = 5) -> Optional[Path]:
|
||||
"""从 url 下载图标至 path"""
|
||||
if not url:
|
||||
return None
|
||||
logger.debug("正在从 %s 下载图标至 %s", url, path)
|
||||
headers = None
|
||||
for time in range(retry):
|
||||
@ -297,7 +299,7 @@ class _HeadIconAssets(_AssetsService):
|
||||
png_path = self.path / f"{icon.id}.png"
|
||||
if not webp_path.exists() and icon.webp:
|
||||
tasks.append(self._download(icon.webp, webp_path))
|
||||
if not png_path.exists():
|
||||
if not png_path.exists() and icon.png:
|
||||
tasks.append(self._download(icon.png, png_path))
|
||||
if len(tasks) >= 100:
|
||||
await asyncio.gather(*tasks)
|
||||
|
Loading…
Reference in New Issue
Block a user