mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
FIX: Invalid Unicode in preload store JSON
This commit is contained in:
parent
bb74c8b9cf
commit
ce0a7739cf
@ -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 New Issue
Block a user