[dl:http] allow '_http_signature' to return a custom error message

… and fail the download immediately like '_http_validate'
This commit is contained in:
Mike Fährmann
2025-06-07 22:01:07 +02:00
parent 27c48ad317
commit 483e30d846

View File

@@ -280,9 +280,13 @@ class HttpDownloader(DownloaderBase):
except (RequestException, SSLError) as exc:
msg = str(exc)
continue
if validate_sig and not validate_sig(file_header):
msg = "Invalid file signature bytes"
continue
if validate_sig:
result = validate_sig(file_header)
if result is not True:
self.release_conn(response)
self.log.warning(
result or "Invalid file signature bytes")
return False
if validate_ext and self._adjust_extension(
pathfmt, file_header) and pathfmt.exists():
pathfmt.temppath = ""