From c5533e9016b83c2370bed430edc547867ee5c7e6 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Fri, 22 Nov 2013 06:58:52 +0100 Subject: [PATCH] restrict rescue-clause in IncludeTag#render As it previously enclosed the whole method, it also wrapped file validation errors, which is not meant to be. Fixes #1745. --- lib/jekyll/tags/include.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index 15f99507..ee1636c7 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -96,14 +96,16 @@ eos path = File.join(dir, file) validate_file(path, context.registers[:site].safe) - partial = Liquid::Template.parse(source(path, context)) + begin + partial = Liquid::Template.parse(source(path, context)) - context.stack do - context['include'] = parse_params(context) if @params - partial.render!(context) + context.stack do + context['include'] = parse_params(context) if @params + partial.render!(context) + end + rescue => e + raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file) end - rescue => e - raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file) end def validate_dir(dir, safe)