mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:23:17 -05:00
FIX: Don't diplay character reference in HTML diffs (#4204)
* FIX: Don't diplay character reference in HTML diffs Before this change, HTML escaping was done before splitting text into tokens, so token splitter saw literals like "'", and split them as it was normal text into parts into ["&", "#", "39", ";"]. This caused diff to display character references, as those tokens used separate HTML tags to display their insertion/deletion status. * Avoid making one element arrays while generating diffs
This commit is contained in:
committed by
Régis Hanol
parent
1883fa205c
commit
9d737d894d
@@ -261,8 +261,7 @@ class DiscourseDiff
|
||||
end
|
||||
|
||||
def characters(string)
|
||||
string = CGI::escapeHTML(string)
|
||||
@tokens.concat string.scan(/(\W|\w+[ \t]*)/).flatten
|
||||
@tokens.concat string.scan(/\W|\w+[ \t]*/).map { |x| CGI::escapeHTML(x) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user