void-packages/srcpkgs/pass-import/patches/0002-tools-magic-support-py...

32 lines
976 B
Diff

From 8cbcd2bdd885c1028065f06b7ab02673c544720b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Mon, 27 Jul 2020 18:00:15 +0700
Subject: [PATCH] tools/magic: support python-magic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
pass_import/tools.py | 3 +++
1 file changed, 3 insertions(+)
diff --git pass_import/tools.py pass_import/tools.py
index 815ff8b..c1a3f01 100644
--- pass_import/tools.py
+++ pass_import/tools.py
@@ -43,6 +43,9 @@ def get_magics(path):
res = magic.detect_from_content(header)
mime_type = res.mime_type
magic_name = res.name
+ elif hasattr(magic, 'from_buffer'):
+ mime_type = magic.from_buffer(header, mime=True)
+ magic_name = magic.from_buffer(header)
else:
return None, None
--
2.28.0.163.g6104cc2f0b