parent
5ba6a36b1f
commit
971815cd5c
|
@ -207,11 +207,14 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sanitizes the given path by removing a leading and adding a trailing slash
|
# Sanitizes the given path by removing a leading and adding a trailing slash
|
||||||
|
|
||||||
|
SANITIZATION_REGEX = %r!\A/|(?<=[^/])\z!
|
||||||
|
|
||||||
def sanitize_path(path)
|
def sanitize_path(path)
|
||||||
if path.nil? || path.empty?
|
if path.nil? || path.empty?
|
||||||
""
|
""
|
||||||
else
|
else
|
||||||
path.gsub(%r!\A/|(?<=[^/])\z!, "".freeze)
|
path.gsub(SANITIZATION_REGEX, "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue