Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Quote marks in Inline code are interpreted

Open doctorwho92 opened this issue 9 years ago • 1 comments

Rocket.Chat Version: 0.54.2 Running Instances: 2 DB Replicaset OpLog: Node Version: v4.8.1

This inline code, encapsulated in three back ticks: export HISTTIMEFORMAT="%F %T " export HISTFILESIZE= export HISTSIZE=

turns into: export HISTTIMEFORMAT="%F %T " export HISTFILESIZE= export HISTSIZE=

i.e. the quote marks are converted into "

doctorwho92 avatar Apr 04 '17 18:04 doctorwho92

This looks very similar to the issue with the missing http in the start of the string, because here the first line is being considered the lang for the code block, and because of this is not being unescaped when returning:

	if singleLine
		lang = ''
		code = _.unescapeHTML codeMatch[1] + codeMatch[2]
	else
		lang = codeMatch[1]
		code = _.unescapeHTML codeMatch[2]
...

I think adding the unescape to the codeMatch[1] that is being set as lang will fix this.

Edit: Please note that, this could cause some issues when the lang should not be escaped, feel free to criticise this solution and point possible exploits of this.

gdelavald avatar Apr 08 '17 05:04 gdelavald