Prevent filename from beginning with /

This commit is contained in:
tcely authored and GitHub committed 2025-03-16 15:17:11 -04:00
1 parent bc6f209d8d
commit c2b21c016e
1 file changed
+2 -1
+2 -1
View File
@@ -1276,7 +1276,8 @@ class Media(models.Model):
# Create a suitable filename from the source media_format
media_format = str(self.source.media_format)
media_details = self.format_dict
return media_format.format(**media_details)
result = media_format.format(**media_details)
return '.' + result if '/' == result[0] else result
@property
def directory_path(self):