Commit db9055aa authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

html.escape and request format

parent a508f5b2
......@@ -20,15 +20,17 @@ def parse_command(string):
e = ET.fromstring(string)
tmp = e.find('cmd')
if tmp!=None:
if tmp!=None and tmp.text!=None:
# have to escape: &
msg['cmd'] = html.escape(tmp.text)
else:
msg['cmd'] = 'state'
tmp = e.findall('target')
tmp = e.find('targets')
if not tmp:
if tmp!=None and tmp.text!=None:
msg['targets'] = tmp.text.split(",")
else:
msg['targets'] = clients
return msg
......
......@@ -2,6 +2,7 @@
import subprocess
import xml.etree.ElementTree as ET
import html
import rclpy
from elphel_interfaces.srv import StrReqStrRes
......@@ -40,7 +41,7 @@ def cmd_callback(req,res):
except subprocess.CalledProcessError:
output = "<error>CalledProcessError</error>".encode()
res.response = '<state>'+output.decode()+'</state>'
res.response = '<state>'+html.escape(output.decode())+'</state>'
print('Slave sending: '+res.response)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment