Merge pull request #725 from jeroenvisser101/performance-start-with-vs-regex

Use start_with? instead of Regex
This commit is contained in:
Justin Li
2016-03-21 10:34:28 -04:00

View File

@@ -65,7 +65,7 @@ module Liquid
File.join(root, @pattern % template_path)
end
raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'" unless File.expand_path(full_path) =~ /\A#{File.expand_path(root)}/
raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'" unless File.expand_path(full_path).start_with?(File.expand_path(root))
full_path
end