HTML character entities displaying incorrectly in pinned topic


(Eric Carlson) #1

Pinned topics at the top of each category are now displaying HTML character entities in their raw form. For example, … is displayed as … instead of ‘…’, and ' does not become an apostrophe. See the screenshot below. I have verified this in both Chrome and Safari on both the desktop and mobile sites.


(Eric Carlson) #2

I’ve been poking around (and learning a wee bit more about the innards of Discourse in the process!). Off hand it appears that the problem comes from the use of Handlebars.SafeString in a change to app/assets/javascripts/discourse/helpers/application_helpers.js in commit a9d34c3. I am guessing that this was an unwanted side-effect of an otherwise good idea.


(Eric Carlson) #3

More poking around tells me that what I suggested in my previous reply was not in fact the problem.

The solution could be as simple as changing the Handlebars templates topic_list_item.js.handlebars (both normal and mobile versions) to triple-{{{ around {{{excerpt}}}. This would still beg the question of when something changed that causes the excerpt string to be HTML-escaped—I presume that it worked correctly in the past—but I believe this would solve the immediate problem.

Unfortunately, I do not (yet) have a good development environment to play around with and to experiment with fixing this.


(Régis Hanol) #4

Thanks I just pushed the fix :star2:

https://github.com/discourse/discourse/commit/57eacdaeed582facfaf0e26a0867745a7f0cb5f9


(Régis Hanol) #5