From 7054a725929e5bb7b904c40a9a12fc040c621da8 Mon Sep 17 00:00:00 2001 From: iory Date: Thu, 1 Sep 2022 16:43:45 +0900 Subject: [PATCH] [jsk_robot_startup/smach_to_mail.py] Add space for concatenated base64 images --- .../jsk_robot_startup/scripts/smach_to_mail.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py b/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py index 5fe51beef4d..89e0f7b8de5 100755 --- a/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py +++ b/jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py @@ -155,17 +155,24 @@ def _send_twitter(self, subject, state_list): if isinstance(subject, bytes): subject = subject.decode('utf-8') text += subject + prev_text_type = '' for x in state_list: if 'DESCRIPTION' in x and x['DESCRIPTION']: desc = x['DESCRIPTION'] if isinstance(desc, bytes): desc = desc.decode('utf-8') text += '\n' + desc + prev_text_type = 'DESCRIPTION' if 'IMAGE' in x and x['IMAGE']: img_txt = x['IMAGE'] if isinstance(img_txt, bytes): img_txt = img_txt.decode('utf-8') + if prev_text_type == 'IMAGE': + # [rostwitter] Do not concatenate + # multiple base64 images without spaces. + text += ' ' text += img_txt + prev_text_type = 'IMAGE' if len(text) > 1: self.pub_twitter.publish(String(text))