summarylogtreecommitdiffstats
path: root/ebec469f4baa.diff
diff options
context:
space:
mode:
Diffstat (limited to 'ebec469f4baa.diff')
-rw-r--r--ebec469f4baa.diff36
1 files changed, 36 insertions, 0 deletions
diff --git a/ebec469f4baa.diff b/ebec469f4baa.diff
new file mode 100644
index 00000000000..1e228d5ac64
--- /dev/null
+++ b/ebec469f4baa.diff
@@ -0,0 +1,36 @@
+
+# HG changeset patch
+# User C├ędric Krier <ced@b2ck.com>
+# Date 1570791867 -7200
+# Node ID ebec469f4baa9523522bb5a81113bf9a381bfc87
+# Parent e1b70835bc9eaa1af25f390ead9dee50c8fbf8fe
+Support file-magic as fallback to python-magic
+
+bug53
+
+diff -r e1b70835bc9e -r ebec469f4baa CHANGES
+--- a/CHANGES Mon Jul 29 16:12:32 2019 +0200
++++ b/CHANGES Fri Oct 11 13:04:27 2019 +0200
+@@ -1,3 +1,5 @@
++* Support file-magic as fallback to python-magic
++
+ 0.9.0 - 20190729
+ * Support out parameter of render
+ * Write opendocument stream directly to the ZipFile
+diff -r e1b70835bc9e -r ebec469f4baa relatorio/templates/opendocument.py
+--- a/relatorio/templates/opendocument.py Mon Jul 29 16:12:32 2019 +0200
++++ b/relatorio/templates/opendocument.py Fri Oct 11 13:04:27 2019 +0200
+@@ -950,7 +950,11 @@
+ binary_data, = image.xpath(
+ './office:binary-data', namespaces=namespaces)
+ data = base64.b64decode(binary_data.text)
+- mime_type = magic.from_buffer(data, mime=True)
++ if hasattr(magic, 'from_buffer'):
++ mime_type = magic.from_buffer(data, mime=True)
++ else:
++ # Not python-magic but file-magic
++ mime_type = magic.detect_from_content(data).mime_type
+ name = 'Pictures/image%s%s' % (
+ i, mimetypes.guess_extension(mime_type))
+ image.remove(binary_data)
+