Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/bin/test_server.py

Issue 5640548127866880: Issue 2678 - Don't consider local files and Windows registry when guessing mime types (Closed)
Patch Set: Created June 12, 2015, 9:41 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/bin/test_server.py
===================================================================
--- a/cms/bin/test_server.py
+++ b/cms/bin/test_server.py
@@ -46,9 +46,9 @@
</body>
</html>"""
-# Create our own instance, the default one will introduce "random" host-specific
-# behavior by parsing local config files.
-mime_types = mimetypes.MimeTypes()
+# Initilize the mimetypes modules manually for consistent behavior,
+# ignoring local files and Windows Registry.
+mimetypes.init([])
Wladimir Palant 2015/06/29 10:42:32 Re-reading the source code I can see the issue - M
def get_page(path):
path = path.strip("/")
@@ -105,7 +105,7 @@
if data is None:
return show_error(start_response, "404 Not Found", uri=path)
- mime = mime_types.guess_type(path)[0] or "text/html"
+ mime = mimetypes.guess_type(path)[0] or "text/html"
if isinstance(data, unicode):
data = data.encode(UNICODE_ENCODING)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld