Skip to content

Commit c0345bf

Browse files
committed
Handle uncaught exception with unexpected /close/committed
Apparently some people/tools send these requests without the "c" GET argument. That caused exceptions to be sent to admins.
1 parent 9576aea commit c0345bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pgcommitfest/commitfest/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,11 @@ def close(request, patchid, status):
12591259
request.user,
12601260
)
12611261

1262-
committer = get_object_or_404(Committer, user__username=request.GET["c"])
1262+
committer_username = request.GET.get("c")
1263+
if committer_username is None:
1264+
messages.error(request, "No committer specified.")
1265+
return HttpResponseRedirect(f"/patch/{patchid}/")
1266+
committer = get_object_or_404(Committer, user__username=committer_username)
12631267
if committer != poc.patch.committer:
12641268
# Committer changed!
12651269
prevcommitter = poc.patch.committer

0 commit comments

Comments
 (0)