Skip to content

Commit 4faee49

Browse files
authored
fix: Handle non integer values passed to object_pk and replied_to (stephenmcd#2012)
1 parent b407cb7 commit 4faee49

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mezzanine/generic/templatetags/comment_tags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def comment_thread(context, parent):
5353
parent_id = parent.id if isinstance(parent, ThreadedComment) else None
5454
try:
5555
replied_to = int(context["request"].POST["replied_to"])
56-
except KeyError:
56+
except (KeyError, ValueError):
5757
replied_to = 0
5858
context.update(
5959
{

mezzanine/generic/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def initial_validation(request, prefix):
8484
try:
8585
model = apps.get_model(*model_data)
8686
obj = model.objects.get(id=post_data.get("object_pk", None))
87-
except (TypeError, ObjectDoesNotExist, LookupError):
87+
except (TypeError, ObjectDoesNotExist, LookupError, ValueError):
8888
redirect_url = "/"
8989
if redirect_url:
9090
if request_is_ajax(request):

0 commit comments

Comments
 (0)