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..d62ba4f753354e58518cdab52a0a3484f6639ded 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,8 +148,12 @@ 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 an index file wasn't found in this directly then we're never going |
+ # to find a file. |
+ if new_path is None: |
+ return FileNotFoundError.RaiseInFuture('"%s" is a directory' % path) |
if new_path is not None: |
path = new_path |