Method: Liquid::LocalFileSystem#full_path

Defined in:
lib/liquid/file_system.rb

#full_path(template_path) ⇒ Object

Raises:



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/liquid/file_system.rb', line 61

def full_path(template_path)
  raise FileSystemError, "Illegal template name '#{template_path}'" unless %r{\A[^./][a-zA-Z0-9_/]+\z}.match?(template_path)

  full_path = if template_path.include?('/')
    File.join(root, File.dirname(template_path), @pattern % File.basename(template_path))
  else
    File.join(root, @pattern % template_path)
  end

  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