Archived
1
0

detect webm/mp4 and set mime type correctly

This commit is contained in:
no 2016-01-07 09:32:50 -05:00
parent 4557503256
commit 13b8a18e21

View File

@ -83,7 +83,10 @@ class Article:
msg += '\n'
msg += self.message() + '\n'
msg += '--{}\n'.format(self.boundary)
msg += 'Content-Type: image/{}\n'.format(self.j['ext'])
mtype = 'image'
if self.j['ext'] in ['.mp4', '.webm']:
mtype = 'video'
msg += 'Content-Type: {}/{}\n'.format(mtype, self.j['ext'])
msg += 'Content-Disposition: form-data; filename="{}{}"; name="import"\n'.format(self.j['filename'], self.j['ext'])
msg += 'Content-Transfer-Encoding: base64\n'
msg += '\n'