From 43661fb8bae86db551cb1eb602dc92ad42af350d Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Wed, 18 Apr 2018 17:54:58 +1000 Subject: [PATCH] server: Support `photo.html` pseudo-page Certain phone browsers (ahhem, ZTE!) ignore the `Content-Type` header and try to parse the URI to figure out what kind of page they're getting sent, and will choke if given a HTML file when the URI ends in `.jpg`. --- tornado_gallery/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tornado_gallery/server.py b/tornado_gallery/server.py index ea30a20..19084f0 100644 --- a/tornado_gallery/server.py +++ b/tornado_gallery/server.py @@ -229,7 +229,7 @@ class GalleryApp(Application): PhotoHandler), (r"/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+\.[a-zA-Z]+)/thumb.jpg", ThumbnailHandler), - (r"/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+\.[a-zA-Z]+)(?:\.html)?", + (r"/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+\.[a-zA-Z]+)(?:/?[a-z]*\.html)?", PhotoPageHandler), (r"/([a-zA-Z0-9_\-]+)/?", GalleryHandler), (r"/", RootHandler),