tuning
authorpenk
Wed, 29 Oct 2003 09:31:15 +0100
changeset 1837 75e19f4e8b05
parent 1836 c1e0cf991a4d
child 1838 2476baed377c
tuning
MIMETypes.st
--- a/MIMETypes.st	Tue Oct 28 16:33:26 2003 +0100
+++ b/MIMETypes.st	Wed Oct 29 09:31:15 2003 +0100
@@ -543,30 +543,27 @@
 
     |type lcSuffix|
 
+    suffix = LastSuffix ifTrue:[
+        ^ LastType
+    ].
+
     lcSuffix := suffix asLowercase.
-    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 := 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 := type ? #unknown.
+        FileSuffixToTypeMapping at:lcSuffix put:type.
     ].
+
     type == #unknown ifTrue:[
-        type := nil
+        type := nil.
     ].
-    type notNil ifTrue:[
-        ^ MIMEType fromString:type
-    ].
+    LastSuffix := suffix.
+    LastType := type.
     ^ type
 
     "
@@ -843,7 +840,7 @@
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.62 2003-09-18 18:22:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.63 2003-10-29 08:31:15 penk Exp $'
 ! !
 
 MIMETypes initialize!