Escaped regular expressions when using post_url.
Previously, the post_url function would give error messages when the post being listed contained special characters for use in regular expressions. These special characters are now escaped using Regexp.escape.
This commit is contained in:
parent
ce67da0f80
commit
bbdeb32f38
|
@ -14,7 +14,8 @@ module Jekyll
|
||||||
"'#{name}' does not contain valid date and/or title."
|
"'#{name}' does not contain valid date and/or title."
|
||||||
end
|
end
|
||||||
|
|
||||||
@name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+|
|
escaped_slug = Regexp.escape(slug)
|
||||||
|
@name_regex = %r!^_posts/#{path}#{date}-#{escaped_slug}\.[^.]+|
|
||||||
^#{path}_posts/?#{date}-#{slug}\.[^.]+!x
|
^#{path}_posts/?#{date}-#{slug}\.[^.]+!x
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue