Updated SVG checks
authorThierry Florac <thierry.florac@onf.fr>
Thu, 05 Jul 2018 18:08:55 +0200
changeset 118 b25ff18873d6
parent 117 2d6c635c323f
child 119 3a9bd68b950c
Updated SVG checks
src/pyams_file/file.py
src/pyams_file/widget/templates/media-input.pt
--- a/src/pyams_file/file.py	Thu Jul 05 15:02:24 2018 +0200
+++ b/src/pyams_file/file.py	Thu Jul 05 18:08:55 2018 +0200
@@ -306,7 +306,7 @@
     content-type recognition
     """
     content_type = get_magic_content_type(data)
-    if content_type == 'image/svg':
+    if content_type.startswith('image/svg'):
         factory = SVGImageFile
     elif content_type.startswith('image/'):
         factory = ImageFile
--- a/src/pyams_file/widget/templates/media-input.pt	Thu Jul 05 15:02:24 2018 +0200
+++ b/src/pyams_file/widget/templates/media-input.pt	Thu Jul 05 18:08:55 2018 +0200
@@ -19,7 +19,7 @@
 				<span i18n:translate="">Delete content</span>
 			</label>
 		</div>
-		<tal:if condition="python:value.content_type == 'image/svg'">
+		<tal:if condition="python:value.content_type.startswith('image/svg')">
 			<div tal:content="structure extension:thumbnail(value, 128, 'auto', 'pull-left margin-5 margin-right-10')">
 				Thumbnail
 			</div>
@@ -45,7 +45,7 @@
 				</div>
 			</div>
 		</tal:if>
-		<tal:if condition="python:value.content_type.startswith('image/') and (value.content_type != 'image/svg')">
+		<tal:if condition="python:value.content_type.startswith('image/') and not value.content_type.startswith('image/svg')">
 			<a class="fancybox hint pull-left margin-5 margin-right-10" data-toggle
 			   data-ams-fancybox-type="image"
 			   data-ams-hint-gravity="e"