Skip to content

Commit

Permalink
decoding to pass as json response
Browse files Browse the repository at this point in the history
Signed-off-by: Duncan Ragsdale <[email protected]>
  • Loading branch information
Thistleman committed Jan 30, 2024
1 parent a5c317b commit 27ef14d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions valhub/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def create_cloudfront_cookie(directory_path):

# Create the signed cookies
signed_cookies = {
'CloudFront-Policy': base64.b64encode(policy.encode('utf8')),
'CloudFront-Signature': base64.b64encode(signature),
'CloudFront-Policy': base64.b64encode(policy.encode('utf-8')).decode('utf-8'),
'CloudFront-Signature': base64.b64encode(signature).decode('utf-8'),
'CloudFront-Key-Pair-Id': key_id
}

Expand Down
4 changes: 1 addition & 3 deletions valhub/submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,7 @@ def get_submission_results(request, submission_id):
ret['file_urls'] = file_urls
ret['cloudfront_cookie'] = cloudfront_cookie

# HTTP Response needed as JSON response cannot handle sending bytes,
# which is used for encoded cookie
return HttpResponse(ret, status=status.HTTP_200_OK)
return JsonResponse(ret, status=status.HTTP_200_OK)

@api_view(["GET"])
@csrf_exempt
Expand Down

0 comments on commit 27ef14d

Please sign in to comment.