resort to "starts with" to find mime type only on plain/text (LP: #600799)
The starts-with determination of mime type was overriding an explicit setting in the mime-type. This was evident when the mime type specified boothook, but the content began with '#!'. In that case, the content would run as a user script rather than boothook.
This commit is contained in:
@@ -65,13 +65,15 @@ def process_includes(msg,parts):
|
||||
payload = part.get_payload()
|
||||
|
||||
ctype = None
|
||||
for str, gtype in starts_with_mappings.items():
|
||||
if payload.startswith(str):
|
||||
ctype = gtype
|
||||
break
|
||||
ctype_orig = part.get_content_type()
|
||||
if ctype_orig == "text/plain":
|
||||
for str, gtype in starts_with_mappings.items():
|
||||
if payload.startswith(str):
|
||||
ctype = gtype
|
||||
break
|
||||
|
||||
if ctype is None:
|
||||
ctype = part.get_content_type()
|
||||
ctype = ctype_orig
|
||||
|
||||
if ctype == 'text/x-include-url':
|
||||
do_include(payload,parts)
|
||||
|
||||
Reference in New Issue
Block a user