forked from CGM_Public/pretix_original
Fix: display cleaned filename in upload forms (#2788)
This commit is contained in:
committed by
GitHub
parent
79beeebfa6
commit
1a401ec1e9
@@ -48,6 +48,8 @@ from django.utils.timezone import now
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_scopes.forms import SafeModelMultipleChoiceField
|
from django_scopes.forms import SafeModelMultipleChoiceField
|
||||||
|
|
||||||
|
from pretix.helpers.hierarkey import clean_filename
|
||||||
|
|
||||||
from ...base.forms import I18nModelForm
|
from ...base.forms import I18nModelForm
|
||||||
|
|
||||||
# Import for backwards compatibility with okd import paths
|
# Import for backwards compatibility with okd import paths
|
||||||
@@ -127,7 +129,7 @@ class ClearableBasenameFileInput(forms.ClearableFileInput):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
if hasattr(self.file, 'display_name'):
|
if hasattr(self.file, 'display_name'):
|
||||||
return self.file.display_name
|
return self.file.display_name
|
||||||
return os.path.basename(self.file.name).split('.', 1)[-1]
|
return clean_filename(os.path.basename(self.file.name))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def url(self):
|
def url(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user