mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-08 01:43:17 +00:00
73bcb9d598
The dot before (?P<extension>...) was not escaped and matched any character instead of a literal period. Escape it to align with MEDIA_STORAGE_URL_PATTERN, which correctly uses \. for the file extension separator.
35 lines
1023 B
Python
35 lines
1023 B
Python
"""
|
|
Core application enums declaration
|
|
"""
|
|
|
|
import re
|
|
|
|
from django.conf import global_settings, settings
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
UUID_REGEX = (
|
|
r"[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
|
|
)
|
|
FILE_EXT_REGEX = r"[a-zA-Z0-9]{1,10}"
|
|
|
|
# pylint: disable=line-too-long
|
|
RECORDING_STORAGE_URL_PATTERN = re.compile(
|
|
rf"{settings.MEDIA_URL:s}{settings.RECORDING_OUTPUT_FOLDER}/(?P<recording_id>{UUID_REGEX:s})\.(?P<extension>{FILE_EXT_REGEX:s})"
|
|
)
|
|
|
|
MEDIA_STORAGE_URL_PATTERN = re.compile(
|
|
f"{settings.MEDIA_URL:s}"
|
|
rf"(?P<key>{settings.FILE_UPLOAD_PATH:s}/(?P<pk>{UUID_REGEX:s})\.{FILE_EXT_REGEX:s})$"
|
|
)
|
|
|
|
|
|
# Django sets `LANGUAGES` by default with all supported languages. We can use it for
|
|
# the choice of languages which should not be limited to the few languages active in
|
|
# the app.
|
|
# pylint: disable=no-member
|
|
ALL_LANGUAGES = getattr(
|
|
settings,
|
|
"ALL_LANGUAGES",
|
|
[(language, _(name)) for language, name in global_settings.LANGUAGES],
|
|
)
|