Open source video conferencing app powered by LiveKit. Built with Django and React.
♻️(backend) refactor uploaded file's key format
lebaudantoinef57db0acc887
diff --git a/src/backend/core/api/viewsets.py b/src/backend/core/api/viewsets.pyindex 8df8492d..09a45860 100644--- a/src/backend/core/api/viewsets.py+++ b/src/backend/core/api/viewsets.py@@ -85,7 +85,7 @@ UUID_REGEX = (FILE_EXT_REGEX = r"[\d\w]+"MEDIA_STORAGE_URL_PATTERN = re.compile(f"{settings.MEDIA_URL:s}"- rf"(?P<key>{FILE_FOLDER:s}/(?P<pk>{UUID_REGEX:s})/\.{FILE_EXT_REGEX:s})$"+ rf"(?P<key>{FILE_FOLDER:s}/(?P<pk>{UUID_REGEX:s})\.{FILE_EXT_REGEX:s})$")diff --git a/src/backend/core/models.py b/src/backend/core/models.pyindex dcf9af15..4e23d76c 100644--- a/src/backend/core/models.py+++ b/src/backend/core/models.py@@ -952,7 +952,7 @@ class File(BaseModel):_, extension = splitext(self.filename)# We store only the extension in the storage system to avoid# leaking Personal Information in logs, etc.- return f"{self.key_base}/{extension!s}"+ return f"{self.key_base}{extension!s}"def get_abilities(self, user):"""diff --git a/src/backend/core/tests/files/test_api_files_create.py b/src/backend/core/tests/files/test_api_files_create.pyindex f02c3476..7b9ae184 100644--- a/src/backend/core/tests/files/test_api_files_create.py+++ b/src/backend/core/tests/files/test_api_files_create.py@@ -118,7 +118,7 @@ def test_api_files_create_file_authenticated_success():assert policy_parsed.scheme == "http"assert policy_parsed.netloc == "localhost:9000"- assert policy_parsed.path == f"/meet-media-storage/files/{file.id!s}/.png"+ assert policy_parsed.path == f"/meet-media-storage/files/{file.id!s}.png"query_params = parse_qs(policy_parsed.query)diff --git a/src/backend/core/tests/files/test_api_files_update.py b/src/backend/core/tests/files/test_api_files_update.pyindex 660f4ba2..a40cf755 100644--- a/src/backend/core/tests/files/test_api_files_update.py+++ b/src/backend/core/tests/files/test_api_files_update.py@@ -39,7 +39,7 @@ def test_api_files_update_anonymous_forbidden():def test_api_files_update_description_and_title():"""- Test the description and title of an file can be updated.+ Test the description and title of a file can be updated."""user = factories.UserFactory()