changeset 646:815a86c7fbf1

svg-edit: SvgEdit action workarounds bug in svg-edit code which removes target URL after altering an existing image
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 06 Feb 2015 08:38:57 +0100
parents b3c95c5e8630
children 63f40df40236
files data/plugin/action/SvgEditor.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/SvgEditor.py	Thu Feb 05 19:17:13 2015 +0100
+++ b/data/plugin/action/SvgEditor.py	Fri Feb 06 08:38:57 2015 +0100
@@ -93,9 +93,11 @@
             # save file
             fpath = AttachFile.getFilename(request, pagename, target).encode(config.charset)
             content = filecontent.decode('base_64')
-            print content
-            p = re.compile(r""" xlink:href""")
-            new_content = p.sub(' target="_blank" xlink:href', content)
+            # Workaround bug in svg-edit editor. On edit of an item the target becomes removed 
+            p = re.compile(r'target="_blank"', re.MULTILINE | re.DOTALL)
+            new_content = p.sub(' ', content)
+            p = re.compile(r""" xlink:href""", re.MULTILINE | re.DOTALL)
+            new_content = p.sub(' target="_blank" xlink:href', new_content)
             with open(fpath, 'w') as f:
                 f.write(new_content)