diff --git a/CHANGES.rst b/CHANGES.rst index bc1f894..043e5db 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,8 @@ Changelog [cekk] - fix file:/// as external link in summary [mamico] +- Updated error message template. Handle 404 redirects for @@download, @@images and @@display-file requests. + [daniele] 5.9.0 (2025-06-26) ------------------ diff --git a/src/redturtle/volto/browser/configure.zcml b/src/redturtle/volto/browser/configure.zcml index acbbdb0..91963eb 100644 --- a/src/redturtle/volto/browser/configure.zcml +++ b/src/redturtle/volto/browser/configure.zcml @@ -98,4 +98,13 @@ layer="redturtle.volto.interfaces.IRedturtleVoltoLayer" condition="have plone-60" /> + + diff --git a/src/redturtle/volto/browser/exceptions.py b/src/redturtle/volto/browser/exceptions.py new file mode 100644 index 0000000..89b4feb --- /dev/null +++ b/src/redturtle/volto/browser/exceptions.py @@ -0,0 +1,12 @@ +from Products.CMFPlone.browser.exceptions import ExceptionView + + +class RTExceptionView(ExceptionView): + + def __call__(self): + matches = ["@@download", "@@images", "@@display-file"] + if any(x in self.request.ACTUAL_URL for x in matches): + self.request.response.redirect(self.request.URL, status=302, lock=1) + return + + return super().__call__() diff --git a/src/redturtle/volto/browser/templates/error_message.pt b/src/redturtle/volto/browser/templates/error_message.pt new file mode 100644 index 0000000..f0a8ea0 --- /dev/null +++ b/src/redturtle/volto/browser/templates/error_message.pt @@ -0,0 +1,79 @@ + + + + + + + + + +

+ This page does not seem to exist… +

+ +
+

+ We apologize for the inconvenience, but the page you were trying to access is not at this address. + You can use the links below to help you find what you are looking for. +

+ +

+ If you are certain you have the correct web address but are encountering an error, please + contact the + site administration. +

+ +

+ Thank you. +

+ +
+
+ +
+ + + +

+ We’re sorry, but there seems to be an error… +

+ +
+
+

+ Here is the full error message: +

+ +
+                
+ + +

+ If you are certain you have the correct web address but are encountering an error, please + contact the + site administration. +

+
+
+ +
+ +
+ + \ No newline at end of file