Skip to content

Commit

Permalink
Fix static_assets unq filtering
Browse files Browse the repository at this point in the history
If some other plugins push object that respond to `#hash` with anything but
Fixnum, calling `#uniq!` will fail. This patch wraps non-standard `#hash`
messages to return Fixnum for `#uniq!`

Resolves #45
  • Loading branch information
ixti committed Oct 12, 2013
1 parent b1843a9 commit 17b7d1a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/jekyll/assets_plugin/patches/site_patch.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# stdlib
require "digest/md5"


# 3rd-party
require "jekyll"

Expand Down Expand Up @@ -56,7 +60,13 @@ def bundle_asset! asset


def __wrap_write
static_files.push(*asset_files).uniq!
static_files.push(*asset_files).uniq! do |asset|
case hash = asset.hash
when Fixnum then hash
else Digest::MD5.new.update(hash.to_s).hash
end
end

__orig_write
end

Expand Down

0 comments on commit 17b7d1a

Please sign in to comment.