Fix a nasty memory/proc leak pointed out by @Xanders. Fixes #1020.
This commit is contained in:
parent
da34153e0c
commit
ae2b6b34f1
1 changed files with 4 additions and 5 deletions
|
@ -60,18 +60,17 @@ module Middleman
|
||||||
|
|
||||||
file_meta = store.metadata_for_file(source_file).dup
|
file_meta = store.metadata_for_file(source_file).dup
|
||||||
if file_meta.has_key?(:blocks)
|
if file_meta.has_key?(:blocks)
|
||||||
result[:blocks] << file_meta.delete(:blocks)
|
result[:blocks] += file_meta.delete(:blocks)
|
||||||
end
|
end
|
||||||
result.deep_merge!(file_meta)
|
result.deep_merge!(file_meta)
|
||||||
|
|
||||||
local_meta = @local_metadata.dup
|
local_meta = @local_metadata.dup
|
||||||
if local_meta.has_key?(:blocks)
|
if local_meta.has_key?(:blocks)
|
||||||
result[:blocks] << local_meta.delete(:blocks)
|
result[:blocks] += local_meta.delete(:blocks)
|
||||||
end
|
end
|
||||||
result.deep_merge!(local_meta)
|
result.deep_merge!(local_meta)
|
||||||
|
|
||||||
result[:blocks] = result[:blocks].flatten.compact
|
result[:blocks] = result[:blocks].flatten.compact
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,10 +79,10 @@ module Middleman
|
||||||
def add_metadata(metadata={}, &block)
|
def add_metadata(metadata={}, &block)
|
||||||
metadata = metadata.dup
|
metadata = metadata.dup
|
||||||
if metadata.has_key?(:blocks)
|
if metadata.has_key?(:blocks)
|
||||||
@local_metadata[:blocks] << metadata.delete(:blocks)
|
@local_metadata[:blocks] += metadata.delete(:blocks)
|
||||||
end
|
end
|
||||||
@local_metadata.deep_merge!(metadata)
|
@local_metadata.deep_merge!(metadata)
|
||||||
@local_metadata[:blocks] << block if block_given?
|
@local_metadata[:blocks] += [ block ] if block_given?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get the output/preview URL for this resource
|
# Get the output/preview URL for this resource
|
||||||
|
|
Loading…
Reference in a new issue