diff --git a/lib/liquid/file_system.rb b/lib/liquid/file_system.rb index 8e71f44..bf7ce1a 100644 --- a/lib/liquid/file_system.rb +++ b/lib/liquid/file_system.rb @@ -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