Sha256: 39c8642179ce8702aa5b03cb373ea96aafea2a051ae7f83144745527366593dd
Contents?: true
Size: 556 Bytes
Versions: 1
Compression:
Stored size: 556 Bytes
Contents
class BaristaController < ActionController::Base caches_page :show if Rails.env.production? def show headers['Content-Type'] = "application/javascript" path = normalize_path(params[:js_path]) p path return head(:forbidden) unless can_render_path?(path) compiled = Barista.render_path(path) compiled.nil? ? head(:not_found) : render(:text => compiled.to_s) end protected def normalize_path(path) File.join(Array.wrap(path).flatten) end def can_render_path?(path) !path.include?("..") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
barista-0.1.0 | app/controllers/barista_controller.rb |