Skip to content
Snippets Groups Projects
Unverified Commit c9ab431a authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

remove control chars and fix blob jekyll

parent e698d5d1
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ class Wordpress
string = string.gsub(' ', ' ')
string = string.gsub('&', '&')
string = ActionView::Base.full_sanitizer.sanitize string
string = remove_lsep string
string = remove_control_chars string
string
end
......@@ -36,13 +36,13 @@ class Wordpress
end
end
html = fragment.to_html(preserve_newline: true)
html = remove_lsep html
html = remove_control_chars html
html
end
def self.remove_lsep(string)
# LSEP is invisible!
string = string.delete("
", "
", "
")
def self.remove_control_chars(string)
# Control chars & LSEP are invisible or hard to detect
string = string.delete("
", "
", "
", "’")
string = string.gsub /\u2028/, ''
string
end
......
......@@ -2,10 +2,12 @@
width, height = @blob.metadata.values_at('width', 'height')
ratio = width.present? && height.present? ? (width.to_f / height.to_f) : nil
%>
name: <%= @blob.filename.to_s %>
size: <%= @blob.byte_size %>
<% if width.present? %>width: <%= width %><% end %>
<% if height.present? %>height: <%= height %><% end %>
<% if ratio.present? %>ratio: <%= ratio %><% end %>
<%# TODO: Replace with the media endpoint when it's ready %>
url: <%= @blob.url %>
<%# TODO: Replace @blob.url with the media endpoint when it's ready %>
<%= {
"name" => @blob.filename.to_s,
"size" => @blob.byte_size,
"width" => width,
"height" => height,
"ratio" => ratio,
"url" => @blob.url
}.compact.to_yaml %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment