Capture menu resolution errors on invalid URLs. Closes GitLab issue #420.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-04-11 21:38:27 -04:00
parent be73264341
commit 2a77078022
3 changed files with 11 additions and 2 deletions

View File

@@ -152,6 +152,7 @@
- Add a new setting option to enable automatic parsing for each new document type created.
- Add support for HTML bodies to the user mailers.
- Production ALLOWED_HOSTS settings now defaults to a safer ['127.0.0.1', 'localhost', '[::1]']
- Capture menu resolution errors on invalid URLs. Closes GitLab issue #420.
2.7.3 (2017-09-11)
==================

View File

@@ -471,6 +471,7 @@ Other changes worth mentioning
- Add a new setting option to enable automatic parsing for each new document type created.
- Add support for HTML bodies to the user mailers.
- Production ALLOWED_HOSTS settings now defaults to a safer ['127.0.0.1', 'localhost', '[::1]']
- Capture menu resolution errors on invalid URLs. Closes GitLab issue #420.
Removals
--------
@@ -539,6 +540,7 @@ Bugs fixed or issues closed
* `GitLab issue #405 <https://gitlab.com/mayan-edms/mayan-edms/issues/405>`_ Add wizard steps from external apps
* `GitLab issue #407 <https://gitlab.com/mayan-edms/mayan-edms/issues/407>`_ Improve search syntax to support search query types: AND, OR
* `GitLab issue #408 <https://gitlab.com/mayan-edms/mayan-edms/issues/408>`_ Improve document checkbox selection.
* `GitLab issue #420 <https://gitlab.com/mayan-edms/mayan-edms/issues/420>`_ Mayan raises a 500 instead of 404 in production mode
* `GitLab issue #437 <https://gitlab.com/mayan-edms/mayan-edms/issues/437>`_ Record users who upload or edit documents
* `GitLab issue #439 <https://gitlab.com/mayan-edms/mayan-edms/issues/439>`_ Toastr library missing after update
* `GitLab issue #447 <https://gitlab.com/mayan-edms/mayan-edms/issues/447>`_ API Security Bug Chinese wall breach

View File

@@ -11,7 +11,7 @@ from django.core.exceptions import PermissionDenied
from django.shortcuts import resolve_url
from django.template import VariableDoesNotExist, Variable
from django.template.defaulttags import URLNode
from django.urls import resolve
from django.urls import Resolver404, resolve
from django.utils.encoding import force_str, force_text
from common.utils import return_attrib
@@ -152,7 +152,13 @@ class Menu(object):
current_path = request.META['PATH_INFO']
# Get sources: view name, view objects
current_view = resolve(current_path).view_name
try:
current_view = resolve(current_path).view_name
except Resolver404:
# Can't figure out which view corresponds to this URL.
# Most likely it is an invalid URL.
logger.warning('Can\'t figure out which view corresponds to this URL: %s; aborting menu resolution.', current_path)
return ()
resolved_navigation_object_list = self.get_resolved_navigation_object_list(
context=context, source=source