Skip to content
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

Windows fix for 1.4.3 issue 1948 + 1946 #2027

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/jekyll/convertible.rb
Expand Up @@ -158,6 +158,19 @@ def do_layout(payload, layouts)
self.render_all_layouts(layouts, payload, info) self.render_all_layouts(layouts, payload, info)
end end


# Obtain destination path.
#
# dest - The String path to the destination dir.
#
# Returns destination file path String.
def destination(dest)
# The url needs to be unescaped in order to preserve the correct filename
# But we need to retain plus and not unescape to a space
path = File.join(dest, CGI.unescape(self.url.gsub('+','%2B')))
path = File.join(path, "index.html") if path[/\.html$/].nil?
path
end

# Write the generated page file to the destination directory. # Write the generated page file to the destination directory.
# #
# dest - The String path to the destination dir. # dest - The String path to the destination dir.
Expand Down
11 changes: 0 additions & 11 deletions lib/jekyll/page.rb
Expand Up @@ -127,17 +127,6 @@ def relative_path
File.join(@dir, @name) File.join(@dir, @name)
end end


# Obtain destination path.
#
# dest - The String path to the destination dir.
#
# Returns the destination file path String.
def destination(dest)
path = File.join(dest, File.expand_path(self.url, "/"))
path = File.join(path, "index.html") if self.url =~ /\/$/
path
end

# Returns the object as a debug String. # Returns the object as a debug String.
def inspect def inspect
"#<Jekyll:Page @name=#{self.name.inspect}>" "#<Jekyll:Page @name=#{self.name.inspect}>"
Expand Down
11 changes: 0 additions & 11 deletions lib/jekyll/post.rb
Expand Up @@ -259,17 +259,6 @@ def render(layouts, site_payload)
do_layout(payload.merge({"page" => self.to_liquid}), layouts) do_layout(payload.merge({"page" => self.to_liquid}), layouts)
end end


# Obtain destination path.
#
# dest - The String path to the destination dir.
#
# Returns destination file path String.
def destination(dest)
# The url needs to be unescaped in order to preserve the correct filename
path = File.join(dest, File.expand_path(CGI.unescape(self.url), "/"))
path = File.join(path, "index.html") if path[/\.html$/].nil?
path
end


# Returns the shorthand String identifier of this Post. # Returns the shorthand String identifier of this Post.
def inspect def inspect
Expand Down
5 changes: 4 additions & 1 deletion lib/jekyll/url.rb
Expand Up @@ -51,8 +51,11 @@ def generate_url
# Returns a sanitized String URL # Returns a sanitized String URL
def sanitize_url(in_url) def sanitize_url(in_url)


# Unescape all URL-encoded dots.
url = in_url.gsub(/%2[eE]/,'.')

# Remove all double slashes # Remove all double slashes
url = in_url.gsub(/\/\//, "/") url = url.gsub(/\/\//, "/")


# Remove every URL segment that consists solely of dots # Remove every URL segment that consists solely of dots
url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/') url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
Expand Down