mirror of https://github.com/CIRCL/PyCIRCLean
Revert change to magic.from_file
parent
c3fed019ab
commit
92d77e1a82
|
@ -240,11 +240,10 @@ class FileBase(object):
|
||||||
self.set_property('symlink_path', os.readlink(file_path))
|
self.set_property('symlink_path', os.readlink(file_path))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(file_path, 'rb') as file:
|
mt = magic.from_file(file_path, mime=True)
|
||||||
mt = magic.from_buffer(file, mime=True)
|
|
||||||
# libmagic will always return something, even if it's just 'data'
|
# libmagic will always return something, even if it's just 'data'
|
||||||
except UnicodeEncodeError as e:
|
except UnicodeEncodeError as e:
|
||||||
raise UnicodeEncodeError(e)
|
raise UnicodeEncodeError
|
||||||
self.add_error(e, '')
|
self.add_error(e, '')
|
||||||
mt = None
|
mt = None
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue