Skip to content

Commit

Permalink
OAuth: protection against deleted objects (#8081)
Browse files Browse the repository at this point in the history
  • Loading branch information
stsewd authored Apr 8, 2021
1 parent bc3e147 commit feb2040
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions readthedocs/oauth/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ def attach_webhook(project_pk, user_pk, integration=None):
connections -- that is, projects that do not have a remote repository them
and were not set up with a VCS provider.
"""
project = Project.objects.get(pk=project_pk)
user = User.objects.get(pk=user_pk)
project = Project.objects.filter(pk=project_pk).first()
user = User.objects.filter(pk=user_pk).first()

if not project or not user:
return False

project_notification = InvalidProjectWebhookNotification(
context_object=project,
user=user,
Expand Down

0 comments on commit feb2040

Please sign in to comment.