forked from CGM_Public/pretix_original
Compatibility with an external file storage separated in pub/ and priv/
This commit is contained in:
@@ -69,4 +69,5 @@ class SettingsForm(i18nfield.forms.I18nFormMixin, HierarkeyForm):
|
||||
)
|
||||
else:
|
||||
fname = '%s/%s.%s.%s' % (self.obj.slug, name, nonce, name.split('.')[-1])
|
||||
return fname
|
||||
# TODO: make sure pub is always correct
|
||||
return 'pub/' + fname
|
||||
|
||||
@@ -437,7 +437,8 @@ class Event(EventMixin, LoggedModel):
|
||||
if s.value.startswith('file://'):
|
||||
fi = default_storage.open(s.value[7:], 'rb')
|
||||
nonce = get_random_string(length=8)
|
||||
fname = '%s/%s/%s.%s.%s' % (
|
||||
# TODO: make sure pub is always correct
|
||||
fname = 'pub/%s/%s/%s.%s.%s' % (
|
||||
self.organizer.slug, self.slug, s.key, nonce, s.value.split('.')[-1]
|
||||
)
|
||||
newname = default_storage.save(fname, fi)
|
||||
|
||||
@@ -86,7 +86,7 @@ class ItemCategory(LoggedModel):
|
||||
|
||||
|
||||
def itempicture_upload_to(instance, filename: str) -> str:
|
||||
return '%s/%s/item-%s-%s.%s' % (
|
||||
return 'pub/%s/%s/item-%s-%s.%s' % (
|
||||
instance.event.organizer.slug, instance.event.slug, instance.id,
|
||||
str(uuid.uuid4()), filename.split('.')[-1]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user