summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 23:04:47 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 23:04:47 +0000
commit52c7ac436dd59f81e38468c033c5108bf642b35a (patch)
treee4a55c65208d7199203f000bc14cb16ea2dbde83
parent2a2c854d0b44532bc0e782f27ed90514c0eb9e6f (diff)
downloadchromium_src-52c7ac436dd59f81e38468c033c5108bf642b35a.zip
chromium_src-52c7ac436dd59f81e38468c033c5108bf642b35a.tar.gz
chromium_src-52c7ac436dd59f81e38468c033c5108bf642b35a.tar.bz2
Docs: Remove unnecessary redirects from directories to 'index' files since we
now do that automatically. Fix a bug preventing the root directory from redirecting to 'index'. R=jyasskin@chromium.org NOTRY=true Review URL: https://codereview.chromium.org/240303006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264337 0039d316-1c4b-4281-b951-d872f2087c98
-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
-rw-r--r--chrome/common/extensions/docs/templates/public/extensions/redirects.json1
-rw-r--r--chrome/common/extensions/docs/templates/public/redirects.json9
-rw-r--r--chrome/docs/redirects.json3
-rw-r--r--native_client_sdk/doc_generated/redirects.json3
10 files changed, 17 insertions, 26 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')
diff --git a/chrome/common/extensions/docs/templates/public/extensions/redirects.json b/chrome/common/extensions/docs/templates/public/extensions/redirects.json
index e2e06ed..700b73b 100644
--- a/chrome/common/extensions/docs/templates/public/extensions/redirects.json
+++ b/chrome/common/extensions/docs/templates/public/extensions/redirects.json
@@ -1,5 +1,4 @@
{
- "": "index",
"experimental.debugger": "debugger",
"experimental_debugger": "debugger",
"experimental.infobars": "infobars",
diff --git a/chrome/common/extensions/docs/templates/public/redirects.json b/chrome/common/extensions/docs/templates/public/redirects.json
index efe7784..6c724a2 100644
--- a/chrome/common/extensions/docs/templates/public/redirects.json
+++ b/chrome/common/extensions/docs/templates/public/redirects.json
@@ -1,9 +1,4 @@
{
- "": "/home/index",
- "apps": "/apps/about_apps",
- "devtools": "/devtools/index",
- "extensions": "/extensions/index",
- "multidevice": "/multidevice/index",
- "native-client": "/native-client/overview",
- "webstore": "/webstore/index"
+ "": "/home",
+ "apps": "/apps/about_apps"
}
diff --git a/chrome/docs/redirects.json b/chrome/docs/redirects.json
deleted file mode 100644
index 2f16825..0000000
--- a/chrome/docs/redirects.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "": "index"
-}
diff --git a/native_client_sdk/doc_generated/redirects.json b/native_client_sdk/doc_generated/redirects.json
deleted file mode 100644
index 2f16825..0000000
--- a/native_client_sdk/doc_generated/redirects.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "": "index"
-}