mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Invalid Unicode in preload store JSON
This commit is contained in:
parent
bb74c8b9cf
commit
ce0a7739cf
2 changed files with 9 additions and 1 deletions
|
@ -19,6 +19,14 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def escape_unicode(javascript)
|
||||
if javascript
|
||||
javascript.gsub(/\342\200\250/u, '
').gsub(/(<\/)/u, '\u003C/').html_safe
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
def with_format(format, &block)
|
||||
old_formats = formats
|
||||
self.formats = [format]
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<%- if @preloaded.present? %>
|
||||
<script>
|
||||
<%- @preloaded.each do |key, json| %>
|
||||
PreloadStore.store("<%= key %>",<%= raw json %>);
|
||||
PreloadStore.store("<%= key %>",<%= escape_unicode(json) %>);
|
||||
<% end %>
|
||||
</script>
|
||||
<%- end %>
|
||||
|
|
Loading…
Reference in a new issue