New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include: fix 'no implicit conversion of nil to String' #5750

Merged
merged 2 commits into from Jan 14, 2017

Conversation

Projects
None yet
4 participants
@parkr
Member

parkr commented Jan 10, 2017

This is when either 'dir' or 'file' is nil and passed File.join.

Backtrace
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/tags/include.rb:115:in `join'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/tags/include.rb:115:in `block in locate_include_file'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/tags/include.rb:114:in `each'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/tags/include.rb:114:in `locate_include_file'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/tags/include.rb:129:in `render'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:151:in `render_token'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:5:in `block in render_token_with_profiling'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/profiler.rb:80:in `profile_token_render'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:4:in `render_token_with_profiling'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:135:in `block in render_all'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `each'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `render_all'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/block.rb:108:in `render'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:210:in `block in render'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:262:in `with_profiling'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:209:in `render'
.bundle/ruby/2.3.0/gems/liquid-3.0.6/lib/liquid/template.rb:222:in `render!'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:28:in `block (2 levels) in render!'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:40:in `measure_bytes'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:27:in `block in render!'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:47:in `measure_time'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:26:in `render!'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:134:in `render_liquid'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:82:in `run'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:463:in `block in render_pages'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:461:in `each'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:461:in `render_pages'
.bundle/ruby/2.3.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:191:in `render'
include: fix 'no implicit conversion of nil to String'
This is when either 'dir' or 'file' is nil.

@parkr parkr requested a review from benbalter Jan 10, 2017

Show outdated Hide outdated lib/jekyll/tags/include.rb
@@ -163,7 +163,7 @@ def load_cached_partial(path, context)
end
def valid_include_file?(path, dir, safe)
!(outside_site_source?(path, dir, safe) || !File.exist?(path))
!(outside_site_source?(path, dir, safe) || !File.file?(path))

This comment has been minimized.

@parkr

parkr Jan 10, 2017

Member

We don't want this to be a directory.

@parkr

parkr Jan 10, 2017

Member

We don't want this to be a directory.

This comment has been minimized.

@ashmaroli

ashmaroli Jan 10, 2017

Member

why not !File.directory?(path) ?

@ashmaroli

ashmaroli Jan 10, 2017

Member

why not !File.directory?(path) ?

This comment has been minimized.

@parkr

parkr Jan 10, 2017

Member

I believe checking to see if it's a file is easier to read - affirmations are easier for us to grok than negations.

@parkr

parkr Jan 10, 2017

Member

I believe checking to see if it's a file is easier to read - affirmations are easier for us to grok than negations.

This comment has been minimized.

@ashmaroli

ashmaroli Jan 10, 2017

Member

checking to see if it's a file

but its !File.file?(path) instead of File.file?(path)...

@ashmaroli

ashmaroli Jan 10, 2017

Member

checking to see if it's a file

but its !File.file?(path) instead of File.file?(path)...

This comment has been minimized.

@benbalter

benbalter Jan 10, 2017

Contributor

yeah, If anything I'd write this as:

!outside_site_source?(path, dir, safe) && File.file?(path)
@benbalter

benbalter Jan 10, 2017

Contributor

yeah, If anything I'd write this as:

!outside_site_source?(path, dir, safe) && File.file?(path)

This comment has been minimized.

@parkr

parkr Jan 11, 2017

Member

Works for me! Updated to Ben's suggestion.

@parkr

parkr Jan 11, 2017

Member

Works for me! Updated to Ben's suggestion.

@parkr parkr added this to the 3.3.2 milestone Jan 10, 2017

@parkr parkr self-assigned this Jan 11, 2017

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jan 14, 2017

Member

@jekyllbot: merge +bug

Member

parkr commented Jan 14, 2017

@jekyllbot: merge +bug

@jekyllbot jekyllbot merged commit aa63deb into master Jan 14, 2017

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jekyllbot jekyllbot added bug fix labels Jan 14, 2017

@jekyllbot jekyllbot deleted the no-implicit-conversion-of-nil-to-string branch Jan 14, 2017

jekyllbot added a commit that referenced this pull request Jan 14, 2017

@ashmaroli

This comment has been minimized.

Show comment
Hide comment
@ashmaroli

ashmaroli Jan 14, 2017

Member

Are we releasing a v3.3.2? Thought the master already had changes that bumped the MINOR version..

Member

ashmaroli commented Jan 14, 2017

Are we releasing a v3.3.2? Thought the master already had changes that bumped the MINOR version..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment