mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-05 03:19:43 +00:00
mime type for file -b
This commit is contained in:
@@ -149,9 +149,13 @@ class Templategen:
|
||||
try:
|
||||
import magic
|
||||
filetype = magic.from_file(src, mime=True)
|
||||
if self.debug:
|
||||
self.log.dbg('using \"magic\" for filetype identification')
|
||||
except ImportError:
|
||||
_, filetype = utils.run(['file', '-b', src],
|
||||
_, filetype = utils.run(['file', '-b', '--mime-type', src],
|
||||
raw=False, debug=self.debug)
|
||||
if self.debug:
|
||||
self.log.dbg('using \"file\" for filetype identification')
|
||||
filetype = filetype.strip()
|
||||
istext = self._is_text(filetype)
|
||||
if self.debug:
|
||||
@@ -167,8 +171,6 @@ class Templategen:
|
||||
out = fileoutput.lower()
|
||||
if out.startswith('text'):
|
||||
return True
|
||||
if 'text' in out:
|
||||
return True
|
||||
if 'empty' in out:
|
||||
return True
|
||||
if 'json' in out:
|
||||
|
||||
Reference in New Issue
Block a user