Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9531)

Unified Diff: chrome/common/extensions/docs/server2/content_provider.py

Issue 240303006: Docs: Remove unnecessary redirects from directories to 'index' files since we (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move check up, remove nacl redirect Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « chrome/common/extensions/docs/server2/app.yaml ('k') | chrome/common/extensions/docs/server2/content_provider_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698