Merge pull request #399 from noirscape/patch-1

Read out mimetypes for cached images
This commit is contained in:
krateng 2025-02-10 03:50:25 +01:00 committed by GitHub
commit ca65813619
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,7 @@ RUN \
apk add --no-cache \
python3 \
py3-lxml \
libmagic \
tzdata && \
echo "" && \
echo "**** install pip dependencies ****" && \

View File

@ -3,6 +3,7 @@ import os
from threading import Thread
from importlib import resources
import time
from magic import from_file
# server stuff
@ -154,7 +155,8 @@ def static_image(pth):
@webserver.route("/cacheimages/<uuid>")
def static_proxied_image(uuid):
return static_file(uuid,root=data_dir['cache']('images'))
mimetype = from_file(os.path.join(data_dir['cache']('images'),uuid),True)
return static_file(uuid,root=data_dir['cache']('images'),mimetype=mimetype)
@webserver.route("/login")
def login():

View File

@ -8,6 +8,7 @@ lru-dict==1.3.*
psutil==5.9.*
sqlalchemy==2.0
python-datauri==3.0.*
python-magic==0.4.*
requests==2.32.*
toml==0.10.*
PyYAML==6.0.*