Add ability to return svg files using pms_image_proxy

This commit is contained in:
JonnyWong16 2025-08-03 09:35:06 -07:00
commit d46710962c
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 6 additions and 2 deletions

View file

@ -675,7 +675,6 @@ General optional parameters:
elif self._api_cmd == 'pms_image_proxy': elif self._api_cmd == 'pms_image_proxy':
if 'return_hash' not in self._api_kwargs: if 'return_hash' not in self._api_kwargs:
cherrypy.response.headers['Content-Type'] = 'image/jpeg'
return out['response']['data'] return out['response']['data']
elif self._api_cmd == 'get_geoip_lookup': elif self._api_cmd == 'get_geoip_lookup':

View file

@ -4753,7 +4753,12 @@ class WebInterface(object):
if isinstance(img, str) and img.startswith('interfaces/default/images'): if isinstance(img, str) and img.startswith('interfaces/default/images'):
fp = os.path.join(plexpy.PROG_DIR, 'data', img) fp = os.path.join(plexpy.PROG_DIR, 'data', img)
return serve_file(path=fp, content_type='image/png') ext = img.rsplit(".", 1)[-1]
if ext == 'svg':
content_type = 'image/svg+xml'
else:
content_type = 'image/{}'.format(ext)
return serve_file(path=fp, content_type=content_type)
if not img and not rating_key: if not img and not rating_key:
if fallback in common.DEFAULT_IMAGES: if fallback in common.DEFAULT_IMAGES: