rebreak tests, move sanitization closer to write

Signed-off-by: Parker Moore <parkrmoore@gmail.com>
This commit is contained in:
Ben Balter 2014-01-06 22:23:51 -05:00 committed by Parker Moore
parent ce425eec8b
commit 323d14845f
1 changed files with 2 additions and 5 deletions

View File

@ -51,11 +51,8 @@ module Jekyll
# Returns a sanitized String URL
def sanitize_url(in_url)
# prevent escaped periods from bypassing sanitization
url = URI.unescape(in_url)
# Remove all double slashes
url = url.gsub(/\/\//, "/")
url = in_url.gsub(/\/\//, "/")
# Remove every URL segment that consists solely of dots
url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
@ -66,7 +63,7 @@ module Jekyll
# Always add a leading slash
url.gsub!(/\A([^\/])/, '/\1')
URI.escape url
url
end
end
end