summaryrefslogtreecommitdiffstats
path: root/WebCore/html/File.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/File.cpp')
-rw-r--r--WebCore/html/File.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/WebCore/html/File.cpp b/WebCore/html/File.cpp
index 25e28e4..97fdc45 100644
--- a/WebCore/html/File.cpp
+++ b/WebCore/html/File.cpp
@@ -27,6 +27,7 @@
#include "File.h"
#include "FileSystem.h"
+#include "MIMETypeRegistry.h"
namespace WebCore {
@@ -34,6 +35,10 @@ File::File(const String& path)
: Blob(path)
, m_name(pathGetFileName(path))
{
+ // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure.
+ int index = m_name.reverseFind('.');
+ if (index != -1)
+ m_type = MIMETypeRegistry::getMIMETypeForExtension(m_name.substring(index + 1));
}
} // namespace WebCore