Skip to content

Commit

Permalink
"fix" incomplete MIME types (#632)
Browse files Browse the repository at this point in the history
e-/exhentai's original image downloads currently send
incomplete/invalid Content-Type headers, "jpg" instead
of "image/jpg" etc, since the last update.
(https://forums.e-hentai.org/index.php?showtopic=236113)

This change prepends any Content-Type value missing a
media type specification with "image/", transforming it
into a valid MIME type.

(A global solution to a local problem, but it shouldn't
 cause any issues anywhere else)
  • Loading branch information
mikf committed Mar 3, 2020
1 parent 72122eb commit 115fd2c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## Unreleased

## 1.13.1 - 2020-03-01
### Additions
- [hentaihand] add extractors ([#605](https://github.com/mikf/gallery-dl/issues/605))
Expand Down
3 changes: 3 additions & 0 deletions gallery_dl/downloader/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ def get_extension(self, response):
mtype = response.headers.get("Content-Type", "image/jpeg")
mtype = mtype.partition(";")[0]

if "/" not in mtype:
mtype = "image/" + mtype

if mtype in MIMETYPE_MAP:
return MIMETYPE_MAP[mtype]

Expand Down
2 changes: 1 addition & 1 deletion gallery_dl/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

__version__ = "1.13.1"
__version__ = "1.13.2-dev"

0 comments on commit 115fd2c

Please sign in to comment.