Commit 264498db authored by mangini@chromium.org's avatar mangini@chromium.org

Fix PRESUBMIT tests for committed files that are not .md or .html

The extensions were being removed before testing, but since only md and html
are considered in the clean urls, the path canonalizer redirects (302) to
the URL with extension. But a 302 of a changed template file is considered a
test fail. Examples that would fail the presubmit tests are images, CSSs,
redirect.json, etc.

BUG=343614
NOTRY=true
R=kalman@chromium.org

Review URL: https://codereview.chromium.org/172573004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252127 0039d316-1c4b-4281-b951-d872f2087c98
parent 29b0a169
...@@ -25,6 +25,8 @@ LOCAL_PUBLIC_TEMPLATES_PATH = os.path.join('docs', ...@@ -25,6 +25,8 @@ LOCAL_PUBLIC_TEMPLATES_PATH = os.path.join('docs',
'templates', 'templates',
'public') 'public')
EXTENSIONS_TO_REMOVE_FOR_CLEAN_URLS = ('.md', '.html')
def _ReadFile(filename): def _ReadFile(filename):
with open(filename) as f: with open(filename) as f:
return f.read() return f.read()
...@@ -48,9 +50,13 @@ def _FindMatchingTemplates(template_name, template_path_list): ...@@ -48,9 +50,13 @@ def _FindMatchingTemplates(template_name, template_path_list):
unix_name = _UnixName(template_name) unix_name = _UnixName(template_name)
for template in template_path_list: for template in template_path_list:
if unix_name == _UnixName(template.split(os.sep)[-1]): if unix_name == _UnixName(template.split(os.sep)[-1]):
# The docserver expects clean (extensionless) template URLs, so we strip basename, ext = os.path.splitext(template)
# extensions here when generating the list of matches. # The docserver expects clean (extensionless) template URLs, so we
matches.append(os.path.splitext(template)[0]) # strip some extensions here when generating the list of matches.
if ext in EXTENSIONS_TO_REMOVE_FOR_CLEAN_URLS:
matches.append(basename)
else:
matches.append(template)
return matches return matches
def _SanitizeAPIName(name, api_path): def _SanitizeAPIName(name, api_path):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment