diff sat/plugins/plugin_xep_0231.py @ 3333:ac9342f359e9

plugin XEP-0329: download thumbnails: - thumbnails are now downloaded directly when BoB is used, `filename` is then filled - `utils.asDeferred` is now used for Jingle methods, so `async` coroutines can be used - (XEP-0231): fixed `dumpData`
author Goffi <goffi@goffi.org>
date Thu, 13 Aug 2020 23:46:18 +0200
parents 4230aaeab9a7
children be6d91572633
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0231.py	Thu Aug 13 23:46:18 2020 +0200
+++ b/sat/plugins/plugin_xep_0231.py	Thu Aug 13 23:46:18 2020 +0200
@@ -17,23 +17,24 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import base64
+import time
+from pathlib import Path
+from functools import partial
+from zope.interface import implementer
+from twisted.python import failure
+from twisted.words.protocols.jabber import xmlstream
+from twisted.words.protocols.jabber import jid
+from twisted.words.protocols.jabber import error as jabber_error
+from twisted.internet import defer
+from wokkel import disco, iwokkel
+from sat.tools import xml_tools
 from sat.core.i18n import _
 from sat.core.constants import Const as C
 from sat.core import exceptions
 from sat.core.log import getLogger
 
 log = getLogger(__name__)
-from sat.tools import xml_tools
-from wokkel import disco, iwokkel
-from zope.interface import implementer
-from twisted.python import failure
-from twisted.words.protocols.jabber import xmlstream
-from twisted.words.protocols.jabber import jid
-from twisted.words.protocols.jabber import error as jabber_error
-from twisted.internet import defer
-from functools import partial
-import base64
-import time
 
 
 PLUGIN_INFO = {
@@ -90,7 +91,7 @@
             PLUGIN_INFO[C.PI_IMPORT_NAME], cid, data_elt.getAttribute("type"), max_age
         ) as f:
 
-            file_path = f.name
+            file_path = Path(f.name)
             f.write(base64.b64decode(str(data_elt)))
 
         return file_path