summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/server2
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/docs/server2')
-rw-r--r--chrome/common/extensions/docs/server2/app.yaml2
-rw-r--r--chrome/common/extensions/docs/server2/content_provider.py10
-rwxr-xr-xchrome/common/extensions/docs/server2/content_provider_test.py2
-rw-r--r--chrome/common/extensions/docs/server2/cron.yaml2
-rw-r--r--chrome/common/extensions/docs/server2/render_servlet.py4
-rwxr-xr-xchrome/common/extensions/docs/server2/render_servlet_test.py7
6 files changed, 15 insertions, 12 deletions
diff --git a/chrome/common/extensions/docs/server2/app.yaml b/chrome/common/extensions/docs/server2/app.yaml
index 8d8922d..c7f5114 100644
--- a/chrome/common/extensions/docs/server2/app.yaml
+++ b/chrome/common/extensions/docs/server2/app.yaml
@@ -1,5 +1,5 @@
application: chrome-apps-doc
-version: 3-17-8
+version: 3-18-0
runtime: python27
api_version: 1
threadsafe: false
diff --git a/chrome/common/extensions/docs/server2/content_provider.py b/chrome/common/extensions/docs/server2/content_provider.py
index c0138f5..d62ba4f 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
diff --git a/chrome/common/extensions/docs/server2/content_provider_test.py b/chrome/common/extensions/docs/server2/content_provider_test.py
index d2e7620..ed7783f 100755
--- a/chrome/common/extensions/docs/server2/content_provider_test.py
+++ b/chrome/common/extensions/docs/server2/content_provider_test.py
@@ -63,6 +63,7 @@ _TEST_DATA = {
'dir.txt': 'dir.txt content',
'dir5.html': 'dir5.html content',
'img.png': 'img.png content',
+ 'index.html': 'index.html content',
'read.txt': 'read.txt content',
'redirects.json': _REDIRECTS_JSON,
'noextension': 'noextension content',
@@ -183,6 +184,7 @@ class ContentProviderUnittest(unittest.TestCase):
self._content_provider.GetContentAndType('oops').Get)
def testIndexRedirect(self):
+ self._assertTemplateContent(u'index.html content', '')
self._assertTemplateContent(u'index.html content 1', 'dir4')
self._assertTemplateContent(u'dir5.html content', 'dir5')
self._assertMarkdownContent(
diff --git a/chrome/common/extensions/docs/server2/cron.yaml b/chrome/common/extensions/docs/server2/cron.yaml
index 0954476..58b5143 100644
--- a/chrome/common/extensions/docs/server2/cron.yaml
+++ b/chrome/common/extensions/docs/server2/cron.yaml
@@ -2,4 +2,4 @@ cron:
- description: Repopulates all cached data.
url: /_cron
schedule: every 5 minutes
- target: 3-17-8
+ target: 3-18-0
diff --git a/chrome/common/extensions/docs/server2/render_servlet.py b/chrome/common/extensions/docs/server2/render_servlet.py
index 2aadb13..fe6d68d 100644
--- a/chrome/common/extensions/docs/server2/render_servlet.py
+++ b/chrome/common/extensions/docs/server2/render_servlet.py
@@ -106,10 +106,6 @@ class RenderServlet(Servlet):
return Response.Redirect('/' + request_path.rstrip('/'),
permanent=False)
- if not path:
- # Empty-path request hasn't been redirected by now. It doesn't exist.
- raise FileNotFoundError('Empty path')
-
content_and_type = content_provider.GetContentAndType(path).Get()
if not content_and_type.content:
logging.error('%s had empty content' % path)
diff --git a/chrome/common/extensions/docs/server2/render_servlet_test.py b/chrome/common/extensions/docs/server2/render_servlet_test.py
index 5ab95a9..d4b97db 100755
--- a/chrome/common/extensions/docs/server2/render_servlet_test.py
+++ b/chrome/common/extensions/docs/server2/render_servlet_test.py
@@ -95,10 +95,11 @@ class RenderServletTest(unittest.TestCase):
self.assertTrue(len(response.content) >
len(ReadFile('%s%s.html' % (PUBLIC_TEMPLATES, html_file))))
- def testIndexRedirect(self):
+ def testIndexRender(self):
response = self._Render('extensions')
- self.assertEqual(('/extensions/index', False),
- response.GetRedirect())
+ self.assertEqual(200, response.status)
+ self.assertEqual(self._Render('extensions/index').content.ToString(),
+ response.content.ToString())
def testOtherRedirectsJsonRedirect(self):
response = self._Render('apps/webview_tag')