2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

content type for gpx and kml

This commit is contained in:
Philip Sargent 2024-07-08 11:59:10 +02:00
parent 5ffe8230b1
commit cb854696c9

View File

@ -305,8 +305,16 @@ def getmimetype(path):
"""Our own version rather than relying on what is provided by the python library. Note that when """Our own version rather than relying on what is provided by the python library. Note that when
Apache or nginx is used to deliver /expofiles/ it will use it's own idea of mimetypes and Apache or nginx is used to deliver /expofiles/ it will use it's own idea of mimetypes and
not these. not these.
This sets the Content Type in the HTTP header, e.g.
Content-Type: text/html; charset=utf-8
""" """
path = str(path) path = str(path)
if path.lower().endswith("gpx"):
return "application/octet-stream"
if path.lower().endswith("kml"):
return "application/octet-stream"
if path.lower().endswith(".css"): if path.lower().endswith(".css"):
return "text/css" return "text/css"
if path.lower().endswith(".txt"): if path.lower().endswith(".txt"):