Skip to content

Commit 56a972b

Browse files
committed
Fix token escape
1 parent e06ff9c commit 56a972b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/dot_ext/views/authorization.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,11 @@ def post(self, request, *args, **kwargs):
371371
except Exception:
372372
tkn = request.POST.get("token")
373373

374+
escaped_tkn = html.escape(tkn)
375+
374376
try:
375377
token = at_model.objects.get(token=tkn)
376378
except at_model.DoesNotExist:
377-
escaped_tkn = html.escape(tkn)
378379
return HttpResponse(f"Token {escaped_tkn} was Not Found. Please check the value and try again.",
379380
status=status.HTTP_404_NOT_FOUND)
380381

@@ -384,8 +385,8 @@ def post(self, request, *args, **kwargs):
384385
application=app
385386
)
386387
dag.delete()
387-
except DataAccessGrant.DoesNotExist as error:
388-
return json_response_from_oauth2_error(error)
388+
except DataAccessGrant.DoesNotExist:
389+
log.debug(f"Token deleted, but DAG lookup failed for token {escaped_tkn}.")
389390

390391
return HttpResponse(content="OK", status=200)
391392

0 commit comments

Comments
 (0)