Hi, I’m not sure if this is the place to post bug reports and I’m also new to ruby and middleman, but here goes:
If there’s a binary SVG file in the project, frontmatter tries to parse it and chokes:
/usr/local/lib/ruby/gems/2.4.0/gems/middleman-core-4.2.1/lib/middleman-core/util/data.rb:60:in `match': invalid byte sequence in UTF-8 (ArgumentError)
from /usr/local/lib/ruby/gems/2.4.0/gems/middleman-core-4.2.1/lib/middleman-core/util/data.rb:60:in `parse'
from /usr/local/lib/ruby/gems/2.4.0/gems/middleman-core-4.2.1/lib/middleman-core/core_extensions/front_matter.rb:79:in `data'
...
A possible fix is to no longer assume that mime type ‘image/svg+xml’ is text in util/binary.rb:
# Is mime type known to be non-binary?
#
# @param [String] mime The mimetype to check.
# @return [Boolean]
Contract String => Bool
def nonbinary_mime?(mime)
if mime.start_with?('text/')
true
# SVG files with mime image/svg+xml can be binary or XML
elsif mime.include?('xml') && !mime.include?('svg') && !mime.include?('officedocument')
true
elsif mime.include?('json')
true
elsif mime.include?('javascript')
true
else
false
end
end