Merge pull request #37 from MrPixelCat/fix/empty-cover-url

fix: do not download covers when URL is an empty string
This commit is contained in:
Lev 2024-04-02 13:48:05 +00:00 committed by GitHub
commit e8cc0b1164
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,9 @@ class CoverInfo:
@classmethod @classmethod
def from_json(cls, data: dict) -> 'CoverInfo': def from_json(cls, data: dict) -> 'CoverInfo':
og_image = data.get("ogImage") og_image = data.get("ogImage")
return cls(f'https://{og_image}' if og_image is not None else None) if og_image is None or og_image == "":
return cls(None)
return cls(f'https://{og_image}')
@dataclass @dataclass