Commit 2d7d93c0 authored by Andreas Jung's avatar Andreas Jung

added support to detect XML files and set content-type to text/xml

(Collector #2248)
parent 3b932eea
......@@ -83,7 +83,7 @@
#
##############################################################################
"""A utility module for content-type handling."""
__version__='$Revision: 1.14 $'[11:-2]
__version__='$Revision: 1.15 $'[11:-2]
from string import split, strip, lower, find
import re, mimetypes
......@@ -95,7 +95,12 @@ def text_type(s):
# Yuk. See if we can figure out the type by content.
if (lower(strip(s)[:6]) == '<html>' or find(s, '</') > 0):
return 'text/html'
return 'text/plain'
elif s.strip().startswith('<?xml'):
return 'text/xml'
else:
return 'text/plain'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment