diff --git a/core/views.py b/core/views.py index fea80d35..9391ad18 100644 --- a/core/views.py +++ b/core/views.py @@ -1,5 +1,6 @@ import mimetypes import os +import uuid as uuid_module import requests from django.contrib.sitemaps.views import index as _sitemap_index_view @@ -8,7 +9,6 @@ from django.core.cache import cache from django.core.exceptions import BadRequest from django.http import FileResponse, Http404, JsonResponse from django.shortcuts import redirect -from django.utils.encoding import force_str from django.utils.http import urlsafe_base64_decode from django.utils.translation import gettext_lazy as _ from django.views.decorators.cache import cache_page @@ -468,7 +468,10 @@ def download_digital_asset_view(request, *args, **kwargs): a JsonResponse with an error message if an error occurs during the process. """ try: - uuid = force_str(urlsafe_base64_decode(str(kwargs.get("encoded_uuid")))) + + uuid_bytes = urlsafe_base64_decode(str(kwargs.get("encoded_uuid"))) + uuid = str(uuid_module.UUID(bytes=uuid_bytes)) + download = DigitalAssetDownload.objects.get(order_product__uuid=uuid) if download.num_downloads >= 1: