mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-29 16:58:01 -05:00
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:
@@ -14,7 +14,8 @@ module Jekyll
|
||||
"'#{name}' does not contain valid date and/or title."
|
||||
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
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user