Improve mpv doublequote sanitisation
This commit is contained in:
parent
2da8e84bba
commit
551ad965aa
@ -357,6 +357,7 @@ function handle_enter()
|
|||||||
if line == '' then
|
if line == '' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
line = string.gsub(line,"\"", "\\\"")
|
||||||
mp.command('print-text "<chat>'..line..'</chat>"')
|
mp.command('print-text "<chat>'..line..'</chat>"')
|
||||||
clear()
|
clear()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -96,6 +96,7 @@ class MplayerPlayer(BasePlayer):
|
|||||||
username = self._sanitizeText(username)
|
username = self._sanitizeText(username)
|
||||||
message = self._sanitizeText(message)
|
message = self._sanitizeText(message)
|
||||||
messageString = u"<{}> {}".format(username, message)
|
messageString = u"<{}> {}".format(username, message)
|
||||||
|
messageString = self._sanitizeText(messageString)
|
||||||
self._listener.sendLine(u'script-message-to syncplayintf chat "{}"'.format(messageString))
|
self._listener.sendLine(u'script-message-to syncplayintf chat "{}"'.format(messageString))
|
||||||
|
|
||||||
def setSpeed(self, value):
|
def setSpeed(self, value):
|
||||||
@ -140,9 +141,13 @@ class MplayerPlayer(BasePlayer):
|
|||||||
def _sanitizeText(self, text):
|
def _sanitizeText(self, text):
|
||||||
text = text.replace("\r", "")
|
text = text.replace("\r", "")
|
||||||
text = text.replace("\n", "")
|
text = text.replace("\n", "")
|
||||||
|
text = text.replace("\\\"", "<SYNCPLAY_QUOTE>")
|
||||||
|
text = text.replace("\"", "<SYNCPLAY_QUOTE>")
|
||||||
text = text.replace("\\", u"\\\\\\uFEFF")
|
text = text.replace("\\", u"\\\\\\uFEFF")
|
||||||
text = text.replace("{", "\\\\{")
|
text = text.replace("{", "\\\\{")
|
||||||
text = text.replace("}", "\\\\}")
|
text = text.replace("}", "\\\\}")
|
||||||
|
text = text.replace("}", "\\\\}")
|
||||||
|
text = text.replace("<SYNCPLAY_QUOTE>","\\\"")
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def _quoteArg(self, arg):
|
def _quoteArg(self, arg):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user