allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [allura] branch master updated: Handle better invalid URLs like /_list/ with no path after
Date Mon, 01 Mar 2021 18:15:01 GMT
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new f6ee5fb  Handle better invalid URLs like /_list/ with no path after
f6ee5fb is described below

commit f6ee5fbb5d7ac371dcfd081e68da7566bd6cdb90
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
AuthorDate: Mon Mar 1 13:14:51 2021 -0500

    Handle better invalid URLs like /_list/ with no path after
---
 Allura/allura/controllers/project.py             | 4 +++-
 Allura/allura/tests/functional/test_tool_list.py | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index ea3ffcd..1afd0e7 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -314,7 +314,9 @@ class ToolListController(object):
     """Renders a list of all tools of a given type in the current project."""
 
     @expose('jinja:allura:templates/tool_list.html')
-    def _default(self, tool_name, page=0, limit=200, **kw):
+    def _default(self, tool_name=None, page=0, limit=200, **kw):
+        if tool_name is None:
+            raise exc.HTTPNotFound
         c.page_list = W.page_list
         tool_name = tool_name.lower()
         entries = c.project.sitemap(included_tools=[tool_name],
diff --git a/Allura/allura/tests/functional/test_tool_list.py b/Allura/allura/tests/functional/test_tool_list.py
index 3f8a0b6..e4b64b0 100644
--- a/Allura/allura/tests/functional/test_tool_list.py
+++ b/Allura/allura/tests/functional/test_tool_list.py
@@ -44,3 +44,6 @@ class TestToolListController(TestController):
         content = r.html.find('div', id='content_base')
         assert not content.find('a', dict(href='/p/test/wiki/')), r
         assert content.find('a', dict(href='/p/test/wiki2/')), r
+
+    def test_missing_path(self):
+        self.app.get('/p/test/_list/', status=404)


Mime
View raw message