Don't look for frontmatter on binary files. Fixes #728
This commit is contained in:
parent
7231f9dfe2
commit
a76b02a55b
3 changed files with 29 additions and 15 deletions
|
@ -10,10 +10,21 @@ require "thor"
|
|||
# Core Pathname library used for traversal
|
||||
require "pathname"
|
||||
|
||||
require 'win32/file' if File::ALT_SEPARATOR
|
||||
|
||||
module Middleman
|
||||
|
||||
module Util
|
||||
|
||||
# Whether the source file is binary.
|
||||
#
|
||||
# @param [String] filename The file to check.
|
||||
# @return [Boolean]
|
||||
def self.binary?(filename)
|
||||
s = (File.read(filename, File.stat(filename).blksize) || "").split(//)
|
||||
((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
|
||||
end
|
||||
|
||||
# The logger
|
||||
#
|
||||
# @return [Middleman::Logger] The logger
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue