This is an automated email from the ASF dual-hosted git repository.
kentontaylor pushed a commit to branch kt/8462
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/kt/8462 by this push:
new 929993eb4 fixup! [#8462] Redirect any missing tools as 301 instead of
404
929993eb4 is described below
commit 929993eb4144ba678cfe9b0092c11e51d8bedc64
Author: Kenton Taylor <[email protected]>
AuthorDate: Tue Sep 13 16:10:45 2022 +0000
fixup! [#8462] Redirect any missing tools as 301 instead of 404
---
Allura/allura/controllers/project.py | 7 +++++--
Allura/allura/tests/functional/test_neighborhood.py | 6 +++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Allura/allura/controllers/project.py
b/Allura/allura/controllers/project.py
index 6b195ebd3..d8606f6cf 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -365,8 +365,11 @@ class ProjectController(FeedController):
c.app = None
return ProjectController(), remainder
- # if a tool doesn't exist, redirect to the first valid tool instead of
404
- self.index()
+ if c.project.is_nbhd_project:
+ raise exc.HTTPNotFound(name)
+ else:
+ # if a tool under a project doesn't exist, redirect to the first
valid tool instead of 404
+ self.index()
@expose('jinja:allura:templates/members.html')
@with_trailing_slash
diff --git a/Allura/allura/tests/functional/test_neighborhood.py
b/Allura/allura/tests/functional/test_neighborhood.py
index 162377da8..038fb21c8 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -866,7 +866,7 @@ class TestNeighborhood(TestController):
def test_neighborhood_namespace(self):
# p/test exists, so try creating adobe/test
- self.app.get('/adobe/test/wiki/', status=301)
+ self.app.get('/adobe/test/wiki/', status=404)
r = self.app.post('/adobe/register',
params=dict(
project_unixname='test', project_name='Test
again',
@@ -984,7 +984,7 @@ class
TestPhoneVerificationOnProjectRegistration(TestController):
def test_verify_phone_no_params(self):
with h.push_config(config, **{'project.verify_phone': 'true'}):
- self.app.get('/p/verify_phone', status=301)
+ self.app.get('/p/verify_phone', status=404)
def test_verify_phone_error(self):
with h.push_config(config, **{'project.verify_phone': 'true'}):
@@ -1039,7 +1039,7 @@ class
TestPhoneVerificationOnProjectRegistration(TestController):
def test_check_phone_verification_no_params(self):
with h.push_config(config, **{'project.verify_phone': 'true'}):
- self.app.get('/p/check_phone_verification', status=301)
+ self.app.get('/p/check_phone_verification', status=404)
@patch.object(g, 'phone_service', autospec=True)
def test_check_phone_verification_error(self, phone_service):