#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Fri, 19 Jan 2018 19:49:35 +0100
changeset 17950 d63391605406
parent 17949 f4ada786326b
child 17951 ea5c9eaf94de
#BUGFIX by cg class: FileApplicationNoteBook::ImageViewApplication class changed: #canOpenItem: clicking on a file with an image-file-suffix: also ask the reader, if the contents is really an image of that type (in case you encounter a .bm file, which is not a bitmap)
FileApplicationNoteBook.st
--- a/FileApplicationNoteBook.st	Fri Jan 19 12:26:40 2018 +0100
+++ b/FileApplicationNoteBook.st	Fri Jan 19 19:49:35 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG
               All Rights Reserved
@@ -4189,8 +4191,13 @@
 !FileApplicationNoteBook::ImageViewApplication class methodsFor:'queries'!
 
 canOpenItem:anItem
-
-    ^ (anItem hasMimeType and:[anItem mimeType isImageType])
+    |mimeType imageReader|
+
+    ^ (anItem hasMimeType 
+    and:[(mimeType := anItem mimeType) isImageType
+    "/ do not trust the mimetype - the contents may not correspond to its mimetype...
+    and:[(imageReader := MIMETypes imageReaderForType:mimeType) notNil
+    and:[imageReader isValidImageFile:anItem fileName]]])
 !
 
 wantNewApplicationAnyway