Skip to content

Commit

Permalink
fix: Handle non integer values passed to object_pk and replied_to (
Browse files Browse the repository at this point in the history
  • Loading branch information
Remiz authored Jan 5, 2022
1 parent b407cb7 commit 4faee49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mezzanine/generic/templatetags/comment_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def comment_thread(context, parent):
parent_id = parent.id if isinstance(parent, ThreadedComment) else None
try:
replied_to = int(context["request"].POST["replied_to"])
except KeyError:
except (KeyError, ValueError):
replied_to = 0
context.update(
{
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/generic/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def initial_validation(request, prefix):
try:
model = apps.get_model(*model_data)
obj = model.objects.get(id=post_data.get("object_pk", None))
except (TypeError, ObjectDoesNotExist, LookupError):
except (TypeError, ObjectDoesNotExist, LookupError, ValueError):
redirect_url = "/"
if redirect_url:
if request_is_ajax(request):
Expand Down

0 comments on commit 4faee49

Please sign in to comment.