Merge pull request #1215 from sanandnarayan/folder_plus

removed cgi unescape in page destination
This commit is contained in:
Matt Rogers 2013-06-25 06:19:41 -07:00
commit c1850a38f7
3 changed files with 17 additions and 3 deletions

View File

@ -134,9 +134,7 @@ module Jekyll
# #
# Returns the destination file path String. # Returns the destination file path String.
def destination(dest) def destination(dest)
# The url needs to be unescaped in order to preserve the correct path = File.join(dest, self.url)
# filename.
path = File.join(dest, CGI.unescape(self.url))
path = File.join(path, "index.html") if self.url =~ /\/$/ path = File.join(path, "index.html") if self.url =~ /\/$/
path path
end end

7
test/source/+/foo.md Normal file
View File

@ -0,0 +1,7 @@
---
layout: default
title : Page inside +
permalink: plus+in+url
---
Line 1
{{ page.title }}

View File

@ -127,6 +127,15 @@ class TestPage < Test::Unit::TestCase
assert File.exists?(File.join(dest_dir, 'contacts.html')) assert File.exists?(File.join(dest_dir, 'contacts.html'))
end end
should "write even when the folder name is plus and permalink has +" do
page = setup_page('+', 'foo.md')
do_render(page)
page.write(dest_dir)
assert File.directory?(dest_dir)
assert File.exists?(File.join(dest_dir, '+', 'plus+in+url'))
end
should "write properly without html extension" do should "write properly without html extension" do
page = setup_page('contacts.html') page = setup_page('contacts.html')
page.site.permalink_style = :pretty page.site.permalink_style = :pretty