MIMETypes.st
changeset 1300 09ff1f28470c
parent 1275 cf421c7dfeec
child 1311 2a297e71602c
--- a/MIMETypes.st	Thu Dec 23 15:56:58 1999 +0100
+++ b/MIMETypes.st	Thu Dec 23 22:29:34 1999 +0100
@@ -16,7 +16,7 @@
 	instanceVariableNames:''
 	classVariableNames:'TypeToImageReaderClassMapping FileSuffixToTypeMapping
 		FilenameToTypeMapping FileSuffixToImageReaderClassMapping
-		CharSetToFontMapping'
+		CharSetToFontMapping LastSuffix LastType'
 	poolDictionaries:''
 	category:'System-Documentation'
 !
@@ -377,16 +377,22 @@
     |type lcSuffix|
 
     lcSuffix := suffix asLowercase.
-    type := FileSuffixToTypeMapping at:lcSuffix ifAbsent:nil.
-    type isNil ifTrue:[
-        "/ allow for fallback ...
-        type := OperatingSystem mimeTypeForSuffix:lcSuffix.
-        "/ the special value #unknown is returned as nil;
-        "/ this avoids constant retry if a mimeType is not known in
-        "/ the OS.
-"/        type isNil ifTrue:[
-"/            FileSuffixToTypeMapping at:lcSuffix put:#unknown
-"/        ].
+    lcSuffix = LastSuffix ifTrue:[
+        type := LastType
+    ] ifFalse:[
+        type := FileSuffixToTypeMapping at:lcSuffix ifAbsent:nil.
+        type isNil ifTrue:[
+            "/ allow for fallback ...
+            type := OperatingSystem mimeTypeForSuffix:lcSuffix.
+            "/ the special value #unknown is returned as nil;
+            "/ this avoids constant retry if a mimeType is not known in
+            "/ the OS.
+    "/        type isNil ifTrue:[
+    "/            FileSuffixToTypeMapping at:lcSuffix put:#unknown
+    "/        ].
+        ].
+        LastSuffix := lcSuffix.
+        LastType := type.
     ].
     type == #unknown ifTrue:[
         type := nil
@@ -394,7 +400,7 @@
     ^ type
 
     "Created: / 30.6.1997 / 21:55:51 / cg"
-    "Modified: / 1.8.1998 / 17:02:59 / cg"
+    "Modified: / 23.12.1999 / 22:30:55 / cg"
 !
 
 mimeTypeForSuffix:suffix put:mimeType
@@ -412,6 +418,6 @@
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.22 1999-12-01 10:29:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.23 1999-12-23 21:29:34 cg Exp $'
 ! !
 MIMETypes initialize!