Index: chrome/common/extensions/docs/server2/content_provider.py |
diff --git a/chrome/common/extensions/docs/server2/content_provider.py b/chrome/common/extensions/docs/server2/content_provider.py |
index c0138f5149de5a2b206d8cdef72b8ebcb6658df7..2db45cd1b94de255111d83a512762c407aab8e72 100644 |
--- a/chrome/common/extensions/docs/server2/content_provider.py |
+++ b/chrome/common/extensions/docs/server2/content_provider.py |
@@ -13,7 +13,7 @@ from docs_server_utils import ToUnicode |
from file_system import FileNotFoundError |
from future import Future |
from path_canonicalizer import PathCanonicalizer |
-from path_util import AssertIsValid, Join, ToDirectory |
+from path_util import AssertIsValid, IsDirectory, Join, ToDirectory |
from special_paths import SITE_VERIFICATION_FILE |
from third_party.handlebar import Handlebar |
from third_party.markdown import markdown |
@@ -148,11 +148,16 @@ class ContentProvider(object): |
new_path = self._AddExt(path) |
# Add a trailing / to check if it is a directory and not a file with |
# no extension. |
- if new_path is None and self.file_system.Exists(path + '/').Get(): |
- new_path = self._AddExt(path + '/index') |
+ if new_path is None and self.file_system.Exists(ToDirectory(path)).Get(): |
+ new_path = self._AddExt(Join(path, 'index')) |
if new_path is not None: |
path = new_path |
+ # If a directory hasn't been rewritten to an index file by now then it's |
Jeffrey Yasskin
2014/04/16 22:44:09
"hasn't been ... by now" implies that something pr
not at google - send to devlin
2014/04/16 23:03:23
Good idea, and a check 4 lines up has more context
|
+ # clearly not found, since this class only knows how to serve files. |
+ if IsDirectory(path): |
+ return FileNotFoundError.RaiseInFuture('"%s" is a directory' % path) |
+ |
return self._content_cache.GetFromFile(path) |
def _AddExt(self, path): |