Skip to content

Commit

Permalink
fix: turn str cast into decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Jan 16, 2024
1 parent 1b4f0e5 commit e68963d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bd_api/custom/graphql_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def ownership_required(f, exc=exceptions.PermissionDenied):

def get_uid(context, exp=r"id:\s[\"]?(\d+)[\"]?"):
try:
query = str(context.body).replace('\\"', "").lower()
query = context.body.decode("utf-8").replace('\\"', "").lower()
except Exception:
query = str(context._post).replace('\\"', "").lower()

Expand All @@ -56,6 +56,7 @@ def wrapper(context, *args, **kwargs):
if context.user.is_superuser:
return f(*args, **kwargs)
uid = get_uid(context)
print(uid)
if context.user.is_anonymous:
if not uid:
return f(*args, **kwargs)
Expand Down

0 comments on commit e68963d

Please sign in to comment.