trivial: pass filename as str() to magic (#15849)

file-magic as currently available on lacks Python 2 support (it was
broken between 2015-10-29 and 2016-02-02 and unfortunately the tarball
on pypi has been uploaded that exact day.)
This commit is contained in:
Frédéric Péters 2017-04-12 18:42:23 +02:00
parent 03baa36769
commit a131ea6635
1 changed files with 1 additions and 1 deletions

View File

@ -167,7 +167,7 @@ class Document(models.Model):
if magic is not None:
magic_object = magic.open(magic.MIME)
magic_object.load()
self.mime_type = magic_object.file(self.content.file.name).split(';')[0]
self.mime_type = magic_object.file(str(self.content.file.name)).split(';')[0]
magic_object.close()
super(Document, self).save(*args, **kwargs)