Fix HTML detection (#6394)
Some servers report a content-type header instead of Content-Type.
This commit is contained in:
parent
d2c3b3884b
commit
01bec7976b
@ -276,7 +276,8 @@ def fetch(self):
|
|||||||
# Check if we somehow got an HTML file rather than the archive we
|
# Check if we somehow got an HTML file rather than the archive we
|
||||||
# asked for. We only look at the last content type, to handle
|
# asked for. We only look at the last content type, to handle
|
||||||
# redirects properly.
|
# redirects properly.
|
||||||
content_types = re.findall(r'Content-Type:[^\r\n]+', headers)
|
content_types = re.findall(r'Content-Type:[^\r\n]+', headers,
|
||||||
|
flags=re.IGNORECASE)
|
||||||
if content_types and 'text/html' in content_types[-1]:
|
if content_types and 'text/html' in content_types[-1]:
|
||||||
tty.warn("The contents of ",
|
tty.warn("The contents of ",
|
||||||
(self.archive_file if self.archive_file is not None
|
(self.archive_file if self.archive_file is not None
|
||||||
|
Loading…
Reference in New Issue
Block a user