diff --git a/dotdrop/templategen.py b/dotdrop/templategen.py index 971dd61..d5a718c 100644 --- a/dotdrop/templategen.py +++ b/dotdrop/templategen.py @@ -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: