[Mono-bugs] [Bug 386008] Can't download files with unknown mime types in 2.0 profile

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 2 09:56:28 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=386008

User rkvinge at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=386008#c1





--- Comment #1 from Rolf Bjarne Kvinge <rkvinge at novell.com>  2008-05-02 07:56:28 MST ---
The following patch fixes this for me:

Index: System.Web/MimeTypes.cs
===================================================================
--- System.Web/MimeTypes.cs     (revision 102111)
+++ System.Web/MimeTypes.cs     (working copy)
@@ -545,10 +545,14 @@
                public static string GetMimeType (string fileName)
                {
                        string result = null;
+                       string extension;
                        int dot = fileName.LastIndexOf ('.');

-                       if (dot != -1 && fileName.Length > dot + 1)
-                               result = mimeTypes [fileName.Substring (dot +
1)] as string;
+                       if (dot != -1 && fileName.Length > dot + 1) {
+                               extension = fileName.Substring (dot + 1);
+                               if (mimeTypes.ContainsKey (extension))
+                                       result = mimeTypes [extension] as
string;
+                       }

                        if (result == null)
                                result = "application/octet-stream";


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list