Do not fail on broken symlink

pull/2/head
Raphaël Vinot 2015-11-24 18:13:41 +01:00
parent 6bc83f947d
commit d6476dab38
1 changed files with 9 additions and 5 deletions

View File

@ -37,6 +37,10 @@ class FileBase(object):
self.log_string = ''
a, self.extension = os.path.splitext(self.src_path)
if os.path.islink(self.src_path):
# magic will throw an IOError on a broken symlink
self.mimetype = 'inode/symlink'
else:
mt = magic.from_file(self.src_path, mime=True)
try:
self.mimetype = mt.decode("utf-8")