Skip to content

Commit

Permalink
Relative posts should never fail to build, even if @dir or @name is nil
Browse files Browse the repository at this point in the history
Fixes #1963
  • Loading branch information
parkr committed Jan 22, 2014
1 parent 30d8743 commit 606c525
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/jekyll/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ def path

# The path to the page source file, relative to the site source
def relative_path
File.join(@dir, @name)
File.join([
@dir.to_s,
@name.to_s
].reject {|x| x.nil? || x.empty?})

This comment has been minimized.

Copy link
@tamouse

tamouse Jan 30, 2014

after you force it to a string, can x ever be nil?

end

# Obtain destination path.
Expand Down
6 changes: 5 additions & 1 deletion lib/jekyll/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ def path

# The path to the post source file, relative to the site source
def relative_path
File.join(@dir, '_posts', @name)
File.join([
@dir.to_s,
"_posts",
@name.to_s
].reject {|x| x.nil? || x.empty?})

This comment has been minimized.

Copy link
@tamouse

tamouse Jan 30, 2014

same question: can x ever be nil?

end

# Compares Post objects. First compares the Post date. If the dates are
Expand Down

0 comments on commit 606c525

Please sign in to comment.