mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-12 03:37:03 +00:00
🔒️(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:
@@ -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)}"
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user