summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/server2/local_fetcher.py
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/docs/server2/local_fetcher.py')
-rw-r--r--chrome/common/extensions/docs/server2/local_fetcher.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/chrome/common/extensions/docs/server2/local_fetcher.py b/chrome/common/extensions/docs/server2/local_fetcher.py
index d36dfa7..eecb746 100644
--- a/chrome/common/extensions/docs/server2/local_fetcher.py
+++ b/chrome/common/extensions/docs/server2/local_fetcher.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import logging
+import mimetypes
import os
class LocalFetcher(object):
@@ -10,6 +11,7 @@ class LocalFetcher(object):
"""
def __init__(self, base_path):
self._base_path = self._ConvertToFilepath(base_path)
+ mimetypes.init()
def _ConvertToFilepath(self, path):
return path.replace('/', os.sep)
@@ -26,4 +28,7 @@ class LocalFetcher(object):
return f.read()
def FetchResource(self, path):
- return self._Resource(self._ReadFile(self._ConvertToFilepath(path)))
+ result = self._Resource(self._ReadFile(self._ConvertToFilepath(path)))
+ base, ext = os.path.splitext(path)
+ result.headers['content-type'] = mimetypes.types_map[ext]
+ return result