You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by di...@apache.org on 2022/05/03 14:14:48 UTC

[allura] 02/02: [#8424] fix for invalid discussion version values in url params

This is an automated email from the ASF dual-hosted git repository.

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

commit 9ff31c15be8cae3fdf80e088ade9e615dbd8c83a
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Tue Apr 5 14:55:24 2022 -0600

    [#8424] fix for invalid discussion version values in url params
---
 Allura/allura/controllers/discuss.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index a22c7a36a..0b0360d46 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -343,7 +343,9 @@ class PostController(BaseController, metaclass=h.ProxiedAttrMeta):
                 ss = HC.query.find(
                     {'artifact_id': self.post._id, 'version': int(version)}).first()
                 if not ss:
-                    raise exc.HTTPNotFound
+                    url = '/p/{}/discussion/{}/thread/{}/{}'.format(c.project.shortname, c.forum.shortname,
+                                                                    self.thread._id, self._post_slug)
+                    utils.permanent_redirect(url)
 
                 class VersionedSnapshotTempObject(Object):
                     pass