]> git.parisson.com Git - teleforma.git/commitdiff
fix set mimetype
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Sat, 9 May 2026 16:14:45 +0000 (18:14 +0200)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Sat, 9 May 2026 16:14:45 +0000 (18:14 +0200)
teleforma/models/core.py

index 5917f18424130a20929049f7375289762090ba37..387bd3b9d800bc8ebe5f4f8db48a9287a81f9dc9 100644 (file)
@@ -1063,8 +1063,13 @@ class Media(MediaBase):
         _('poster file'), upload_to='items/%Y/%m/%d', max_length=255, null=True, blank=False)
 
     def set_mime_type(self):
+        path = None
         if self.file:
-            mime_type = guess_mimetypes(self.file.path)
+            path = self.file.path
+        elif self.file_s3:
+            path = self.file_s3.name
+        if path:
+            mime_type = guess_mimetypes(path)
             if mime_type == 'audio/mpeg':
                 self.mime_type = 'audio/mp3'
             else: