Enhance size validation for indexer results

This commit is contained in:
Juan David Bermudez Celedon
2026-02-01 22:02:45 -05:00
parent caaa08fbf4
commit a1f3f92c10

View File

@@ -61,15 +61,23 @@ class TorznabMixin:
if upload_volume_factor == 2:
flags.append("doubleupload")
if not item.find("size") or item.find("size").text is None:
title = item.find("title").text
size_str = item.find("size")
if size_str is None or size_str.text is None:
log.warning(
f"Torznab item {item.find('title').text} has no size, skipping."
f"Torznab item {title} has no size, skipping."
)
continue
try:
size = int(size_str.text or "0")
except ValueError:
log.warning(
f"Torznab item {title} has invalid size, skipping."
)
continue
size = int(item.find("size").text or "0")
result = IndexerQueryResult(
title=item.find("title").text or "unknown",
title=title or "unknown",
download_url=str(item.find("enclosure").attrib["url"]),
seeders=seeders,
flags=flags,