allow extensions to be capatalised

This commit is contained in:
Martin 2012-08-14 15:05:15 +02:00
parent 28047277f1
commit 951f88a59a

View File

@ -78,20 +78,20 @@ def flatpage(request, path):
return HttpResponse(o.read(), mimetype=getmimetype(path)) return HttpResponse(o.read(), mimetype=getmimetype(path))
def getmimetype(path): def getmimetype(path):
if path.endswith(".png"): return "image/png" if path.lower().endswith(".png"): return "image/png"
if path.endswith(".tif"): return "image/tif" if path.lower().endswith(".tif"): return "image/tif"
if path.endswith(".gif"): return "image/gif" if path.lower().endswith(".gif"): return "image/gif"
if path.endswith(".jpeg"): return "image/jpeg" if path.lower().endswith(".jpeg"): return "image/jpeg"
if path.endswith(".jpg"): return "image/jpeg" if path.lower().endswith(".jpg"): return "image/jpeg"
if path.endswith("svg"): return "image/svg+xml" if path.lower().endswith("svg"): return "image/svg+xml"
if path.endswith(".pdf"): return "application/pdf" if path.lower().endswith(".pdf"): return "application/pdf"
if path.endswith(".ps"): return "application/postscript" if path.lower().endswith(".ps"): return "application/postscript"
if path.endswith(".svx"): return "application/x-survex-svx" if path.lower().endswith(".svx"): return "application/x-survex-svx"
if path.endswith(".3d"): return "application/x-survex-3d" if path.lower().endswith(".3d"): return "application/x-survex-3d"
if path.endswith(".pos"): return "application/x-survex-pos" if path.lower().endswith(".pos"): return "application/x-survex-pos"
if path.endswith(".err"): return "application/x-survex-err" if path.lower().endswith(".err"): return "application/x-survex-err"
if path.endswith(".odt"): return "application/vnd.oasis.opendocument.text" if path.lower().endswith(".odt"): return "application/vnd.oasis.opendocument.text"
if path.endswith(".ods"): return "application/vnd.oasis.opendocument.spreadsheet" if path.lower().endswith(".ods"): return "application/vnd.oasis.opendocument.spreadsheet"
return "" return ""
@login_required_if_public @login_required_if_public