[dl:http] improve HTML signature check (#7697)

https://github.com/mikf/gallery-dl/issues/7697#issuecomment-2990734451

ignore leading whitespace
This commit is contained in:
Mike Fährmann
2025-06-20 14:39:32 +02:00
parent dba45923c8
commit bcfce6b7db
2 changed files with 3 additions and 1 deletions

View File

@@ -486,7 +486,8 @@ MIME_TYPES = {
def _signature_html(s):
return b"<!doctype html".startswith(s[:14].lower())
s = s[:14].lstrip()
return s and b"<!doctype html".startswith(s.lower())
# https://en.wikipedia.org/wiki/List_of_file_signatures