Commit 62f09430 authored by Jérome Perrin's avatar Jérome Perrin

TextDocument: don't change xml documents content type

if their content type ended in xml ( such as image/svg+xml ),
TextDocument._convertToBaseFormat was resetting the content type to
application/xml.

When doing something like:

  wp = web_page_module.newContent(
    portal_type='Web Page',
    content_type='image/svg+xml',
    text_content=svg
  )

wp.getContentType() was sometimes 'image/svg+xml' sometimes
'application/xml', depending on the order of edit.
parent 1562cfe6
......@@ -315,7 +315,6 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin, TextContent
try:
tree = etree.fromstring(text_content)
text_content = etree.tostring(tree, encoding='utf-8', xml_declaration=True)
content_type = 'application/xml'
message = 'Conversion to base format succeeds'
except etree.XMLSyntaxError: # pylint: disable=catching-non-exception
message = 'Conversion to base format without codec fails'
......
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