diff src/plugins/plugin_xep_0264.py @ 2521:327bbbe793ce

plugin XEP-0264: handle truncated files
author Goffi <goffi@goffi.org>
date Wed, 14 Mar 2018 08:11:20 +0100
parents 2d3c9dcec384
children 65e278997715
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0264.py	Wed Mar 14 08:10:31 2018 +0100
+++ b/src/plugins/plugin_xep_0264.py	Wed Mar 14 08:11:20 2018 +0100
@@ -36,6 +36,10 @@
 except:
     raise exceptions.MissingModule(u"Missing module pillow, please download/install it from https://python-pillow.github.io")
 
+# cf. https://stackoverflow.com/a/23575424
+from PIL import ImageFile
+ImageFile.LOAD_TRUNCATED_IMAGES = True
+
 try:
     from twisted.words.protocols.xmlstream import XMPPHandler
 except ImportError: