Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0329.py @ 3516:e47aa1fb7b24
plugin XEP-0329: fix root node retrieval and `_fileSendingRequestTrigger` return value
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 May 2021 18:25:42 +0200 |
parents | 73b8a8d938be |
children | 888109774673 04283582966f |
comparison
equal
deleted
inserted
replaced
3515:2dce411c2647 | 3516:e47aa1fb7b24 |
---|---|
210 log.warning(_( | 210 log.warning(_( |
211 'parent dir ("..") found in path, hack attempt? path is {path} ' | 211 'parent dir ("..") found in path, hack attempt? path is {path} ' |
212 '[{profile}]').format(path=path, profile=client.profile)) | 212 '[{profile}]').format(path=path, profile=client.profile)) |
213 raise exceptions.PermissionError("illegal path elements") | 213 raise exceptions.PermissionError("illegal path elements") |
214 | 214 |
215 if not path_elts: | |
216 raise exceptions.DataError(_("path is invalid: {path}").format(path=path)) | |
217 | |
218 node = client._XEP_0329_root_node | 215 node = client._XEP_0329_root_node |
219 | 216 |
220 while path_elts: | 217 while path_elts: |
221 if node.type == TYPE_VIRTUAL: | 218 if node.type == TYPE_VIRTUAL: |
222 try: | 219 try: |
446 path, | 443 path, |
447 uid=self._jf.getProgressId(session, content_name), | 444 uid=self._jf.getProgressId(session, content_name), |
448 size=size, | 445 size=size, |
449 data_cb=lambda data: hasher.update(data), | 446 data_cb=lambda data: hasher.update(data), |
450 ) | 447 ) |
451 return False, True | 448 return False, defer.succeed(True) |
452 | 449 |
453 # common methods | 450 # common methods |
454 | 451 |
455 def _requestHandler(self, client, iq_elt, root_nodes_cb, files_from_node_cb): | 452 def _requestHandler(self, client, iq_elt, root_nodes_cb, files_from_node_cb): |
456 iq_elt.handled = True | 453 iq_elt.handled = True |