mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 03:48:02 -05:00
Added code to set proper content-type header on images being displayed via webgui
This commit is contained in:
parent
fd03e0394d
commit
bfea9329b4
@ -264,7 +264,7 @@ class MainHandler(RequestHandler):
|
|||||||
else:
|
else:
|
||||||
default_image_name = 'banner.png'
|
default_image_name = 'banner.png'
|
||||||
|
|
||||||
default_image_path = ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', 'slick', 'images', default_image_name)
|
image_path = ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', 'slick', 'images', default_image_name)
|
||||||
if show and sickbeard.helpers.findCertainShow(sickbeard.showList, int(show)):
|
if show and sickbeard.helpers.findCertainShow(sickbeard.showList, int(show)):
|
||||||
cache_obj = image_cache.ImageCache()
|
cache_obj = image_cache.ImageCache()
|
||||||
|
|
||||||
@ -279,10 +279,12 @@ class MainHandler(RequestHandler):
|
|||||||
image_file_name = cache_obj.banner_thumb_path(show)
|
image_file_name = cache_obj.banner_thumb_path(show)
|
||||||
|
|
||||||
if ek.ek(os.path.isfile, image_file_name):
|
if ek.ek(os.path.isfile, image_file_name):
|
||||||
with file(image_file_name, 'rb') as img:
|
image_path = image_file_name
|
||||||
return img.read()
|
|
||||||
|
|
||||||
with file(default_image_path, 'rb') as img:
|
from mimetypes import MimeTypes
|
||||||
|
mime_type, encoding = MimeTypes().guess_type(image_path)
|
||||||
|
self.set_header('Content-Type', mime_type)
|
||||||
|
with file(image_path, 'rb') as img:
|
||||||
return img.read()
|
return img.read()
|
||||||
|
|
||||||
def setHomeLayout(self, layout):
|
def setHomeLayout(self, layout):
|
||||||
|
Loading…
Reference in New Issue
Block a user