# HG changeset patch # User Goffi # Date 1580845637 -3600 # Node ID a90f26e89a4a1762014a1cc45b003e37371a5308 # Parent c7f1176cd2a979af0b293d086433664a11b86715 share widget: fixed crash when a text content is shared without `text` in data: sometimes, text content is shared via a path and not directly the `text` key. This is the case with vCards. This patch fixes share widget to handle this case. diff -r c7f1176cd2a9 -r a90f26e89a4a cagou/core/share_widget.py --- a/cagou/core/share_widget.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/core/share_widget.py Tue Feb 04 20:47:17 2020 +0100 @@ -102,7 +102,7 @@ def on_kv_post(self, wid): self.type, self.subtype = self.media_type.split('/') - if self.type == 'text': + if self.type == 'text' and 'text' in self.data: self.preview_box.add_widget(TextPreview(text=self.data['text'])) elif self.type == 'image': self.preview_box.add_widget(ImagePreview(path=self.data['path'])) @@ -126,7 +126,7 @@ G.host.doAction('chat', contact_jid, [profile]) chat_wid = G.host.selected_widget - if self.type == 'text': + if self.type == 'text' and 'text' in self.data: text = self.data['text'] chat_wid.message_input.text += text else: diff -r c7f1176cd2a9 -r a90f26e89a4a cagou/plugins/plugin_wid_file_sharing.py --- a/cagou/plugins/plugin_wid_file_sharing.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/plugins/plugin_wid_file_sharing.py Tue Feb 04 20:47:17 2020 +0100 @@ -17,9 +17,11 @@ # along with this program. If not, see . +from functools import partial +import os.path +import json from sat.core import log as logging from sat.core import exceptions -log = logging.getLogger(__name__) from sat.core.i18n import _ from sat.tools.common import files_utils from sat_frontends.quick_frontend import quick_widgets @@ -35,9 +37,8 @@ from kivy.uix.label import Label from kivy.uix.button import Button from kivy import utils as kivy_utils -from functools import partial -import os.path -import json + +log = logging.getLogger(__name__) PLUGIN_INFO = {