mirror of https://github.com/CIRCL/PyCIRCLean
try to fix magic
parent
531ab43dae
commit
9079eac90a
|
@ -16,6 +16,7 @@ addons:
|
|||
- p7zip-full
|
||||
|
||||
install:
|
||||
- pip install git+https://github.com/Rafiot/python-magic.git@travis
|
||||
- sudo add-apt-repository ppa:fontforge/fontforge --yes
|
||||
- sudo add-apt-repository ppa:coolwanglu/pdf2htmlex --yes
|
||||
- sudo apt-get update -qq
|
||||
|
@ -28,7 +29,6 @@ install:
|
|||
- make
|
||||
- sudo make install
|
||||
- popd
|
||||
- pip install python-magic
|
||||
- pip install lxml
|
||||
- pip install officedissector
|
||||
- if [ $(python -c 'import sys; print(sys.version_info.major)') == '2' ]; then pip install oletools olefile ; fi
|
||||
|
|
|
@ -50,9 +50,12 @@ class File(FileBase):
|
|||
self.main_type = ''
|
||||
self.main_type = ''
|
||||
try:
|
||||
mimetype = magic.from_file(src_path, mime=True).decode("utf-8")
|
||||
mimetype = magic.from_file(src_path, mime=True)
|
||||
try:
|
||||
mimetype = mimetype.decode("utf-8")
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print('************************** BROKEN', self.src_path)
|
||||
print('************************** BROKEN', self.src_path, e)
|
||||
self.make_dangerous()
|
||||
return
|
||||
|
|
|
@ -17,9 +17,13 @@ class FileSpec(FileBase):
|
|||
super(FileSpec, self).__init__(src_path, dst_path)
|
||||
a, self.extension = os.path.splitext(self.src_path)
|
||||
try:
|
||||
self.mimetype = magic.from_file(self.src_path, mime=True).decode("utf-8")
|
||||
except:
|
||||
print('************************** BROKEN', self.src_path)
|
||||
self.mimetype = magic.from_file(self.src_path, mime=True)
|
||||
try:
|
||||
self.imetype = self.mimetype.decode("utf-8")
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print('************************** BROKEN', self.src_path, e)
|
||||
|
||||
|
||||
class KittenGroomerSpec(KittenGroomerBase):
|
||||
|
|
Loading…
Reference in New Issue