Escape regex characters in paths to match (#8138)

Merge pull request 8138
This commit is contained in:
Daniel Leidert 2020-04-27 11:21:07 +02:00 committed by GitHub
parent c8c3891cab
commit 47e3644cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ class TestConvertible < JekyllUnitTest
assert_equal({}, ret) assert_equal({}, ret)
end end
assert_match(%r!YAML Exception!, out) assert_match(%r!YAML Exception!, out)
assert_match(%r!#{File.join(@base, name)}!, out) assert_match(%r!#{Regexp.escape(File.join(@base, name))}!, out)
end end
should "raise for broken front matter with `strict_front_matter` set" do should "raise for broken front matter with `strict_front_matter` set" do
@ -57,7 +57,7 @@ class TestConvertible < JekyllUnitTest
assert_equal({}, ret) assert_equal({}, ret)
end end
assert_match(%r!invalid byte sequence in UTF-8!, out) assert_match(%r!invalid byte sequence in UTF-8!, out)
assert_match(%r!#{File.join(@base, name)}!, out) assert_match(%r!#{Regexp.escape(File.join(@base, name))}!, out)
end end
should "parse the front matter but show an error if permalink is empty" do should "parse the front matter but show an error if permalink is empty" do