# HG changeset patch # User Goffi # Date 1591675137 -7200 # Node ID f5a5aa9fa73a62ab397b37cf16ab2dd06019c6d9 # Parent 84f77f04aa088e02a90a1d5220328342babdf00a plugin XEP-0363: fixed fileHTTPUploadGetSlot diff -r 84f77f04aa08 -r f5a5aa9fa73a sat/plugins/plugin_xep_0363.py --- a/sat/plugins/plugin_xep_0363.py Mon Jun 08 08:54:53 2020 +0200 +++ b/sat/plugins/plugin_xep_0363.py Tue Jun 09 05:58:57 2020 +0200 @@ -93,7 +93,7 @@ "fileHTTPUploadGetSlot", ".plugin", in_sign="sisss", - out_sign="(ss)", + out_sign="(ssaa{ss})", method=self._getSlot, async_=True, ) @@ -272,15 +272,17 @@ This method can be used when uploading is done by the frontend @param filename(unicode): name of the file to upload @param size(int): size of the file (must be non null) - @param upload_jid(jid.JID(), None, ''): HTTP upload capable entity + @param upload_jid(str, ''): HTTP upload capable entity @param content_type(unicode, None): MIME type of the content empty string or None to guess automatically """ client = self.host.getClient(profile_key) filename = filename.replace("/", "_") - return defer.ensureDeferred(self.getSlot( - client, filename, size, content_type or None, upload_jid or None + d = defer.ensureDeferred(self.getSlot( + client, filename, size, content_type or None, jid.JID(upload_jid) or None )) + d.addCallback(lambda slot: (slot.get, slot.put, slot.headers)) + return d async def getSlot(self, client, filename, size, content_type=None, upload_jid=None): """Get a slot (i.e. download/upload links) @@ -304,7 +306,7 @@ try: upload_jid = client.http_upload_service except AttributeError: - found_entity = await self.getHTTPUploadEntity(profile=client.profile) + found_entity = await self.getHTTPUploadEntity(client) return await self.getSlot( client, filename, size, content_type, found_entity) else: