Skip to content

Commit 7054a72

Browse files
iorytkmtnt7000
authored andcommitted
[jsk_robot_startup/smach_to_mail.py] Add space for concatenated base64 images
1 parent 6ebe0e4 commit 7054a72

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,17 +155,24 @@ def _send_twitter(self, subject, state_list):
155155
if isinstance(subject, bytes):
156156
subject = subject.decode('utf-8')
157157
text += subject
158+
prev_text_type = ''
158159
for x in state_list:
159160
if 'DESCRIPTION' in x and x['DESCRIPTION']:
160161
desc = x['DESCRIPTION']
161162
if isinstance(desc, bytes):
162163
desc = desc.decode('utf-8')
163164
text += '\n' + desc
165+
prev_text_type = 'DESCRIPTION'
164166
if 'IMAGE' in x and x['IMAGE']:
165167
img_txt = x['IMAGE']
166168
if isinstance(img_txt, bytes):
167169
img_txt = img_txt.decode('utf-8')
170+
if prev_text_type == 'IMAGE':
171+
# [rostwitter] Do not concatenate
172+
# multiple base64 images without spaces.
173+
text += ' '
168174
text += img_txt
175+
prev_text_type = 'IMAGE'
169176
if len(text) > 1:
170177
self.pub_twitter.publish(String(text))
171178

0 commit comments

Comments
 (0)