mirror of https://github.com/CIRCL/PyCIRCLean
Do not fail on broken symlink
parent
6bc83f947d
commit
d6476dab38
|
@ -37,6 +37,10 @@ class FileBase(object):
|
||||||
self.log_string = ''
|
self.log_string = ''
|
||||||
a, self.extension = os.path.splitext(self.src_path)
|
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)
|
mt = magic.from_file(self.src_path, mime=True)
|
||||||
try:
|
try:
|
||||||
self.mimetype = mt.decode("utf-8")
|
self.mimetype = mt.decode("utf-8")
|
||||||
|
|
Loading…
Reference in New Issue