🔒️(backend) prevent accessing files if they are not ready

With the addition of the ANALYSING state
files could be accessed in the short time they
were in that state.
We now require files to be in ready.

Also adds missing frontend types (no impact).
This commit is contained in:
Florent Chehab
2026-06-03 15:15:24 +02:00
parent 22b2e6bd1e
commit c79984a883
7 changed files with 16 additions and 11 deletions
+1 -1
View File
@@ -456,7 +456,7 @@ class ListFileSerializer(serializers.ModelSerializer):
def get_url(self, obj):
"""Return the URL of the file."""
if obj.is_pending_upload:
if not obj.is_ready:
return None
return f"{settings.MEDIA_BASE_URL}{settings.MEDIA_URL}{quote(obj.file_key)}"
+1 -1
View File
@@ -1417,7 +1417,7 @@ class FileViewSet(
request, MEDIA_STORAGE_URL_PATTERN
)
if file.is_pending_upload:
if not file.is_ready:
logger.warning("File '%s' is not ready", file.id)
raise drf_exceptions.PermissionDenied()