Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
Update cachebuster to open files in binary mode
Browse files Browse the repository at this point in the history
It seems there's an issue where the fingerprint of a PNG file will always be 658e8dc0bf8b9a09b36994abf9242099, due to the way File.read works (see https://groups.google.com/forum/#!topic/asciidoc/SUsR8GcqZ08). This commit changes fingerprint_file to open the file in binary mode.
  • Loading branch information
oleg-codaio committed Sep 2, 2014
1 parent cf38117 commit 2a10aab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nanoc/cachebuster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def self.should_apply_fingerprint_to_file?(item)
end

def self.fingerprint_file(filename, length = 8)
CACHEBUSTER_PREFIX + Digest::MD5.hexdigest(File.read(filename))[0..length.to_i]
CACHEBUSTER_PREFIX + Digest::MD5.hexdigest(File.open(filename, 'rb'){|io| io.read})[0..length.to_i]
end
end

Expand Down

0 comments on commit 2a10aab

Please sign in to comment.