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