1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Hopefully fixed image proxying

This commit is contained in:
krateng 2022-03-06 04:20:26 +01:00
parent 57142bc327
commit 02e3f17594
2 changed files with 11 additions and 3 deletions

View File

@ -320,7 +320,7 @@ def track_info(dbconn=None,**keys):
def issues():
def issues(dbconn=None):
return ISSUES
def check_issues():
@ -413,7 +413,7 @@ def check_issues():
def get_predefined_rulesets():
def get_predefined_rulesets(dbconn=None):
validchars = "-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
rulesets = []

View File

@ -5,6 +5,7 @@ from threading import Thread
import setproctitle
import pkg_resources
from css_html_js_minify import html_minify, css_minify
import datauri
# server stuff
@ -165,7 +166,14 @@ def dynamic_image():
result = get_artist_image(relevant['artist'])
if result is None: return ""
redirect(result,307)
if result.startswith("data:"):
# data uris are directly served as image because a redirect to a data uri
# doesnt work
duri = datauri.DataURI(result)
response.content_type = duri.mimetype
return duri.data
else:
redirect(result,307)
@webserver.route("/images/<pth:re:.*\\.jpeg>")
@webserver.route("/images/<pth:re:.*\\.jpg>")