Sha256: 0a97e0a46fc6bb1b7a9c71cf47b373d1ea740ea785eae82f3d2f22efc4acb95d

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

module AdminData
  class PublicController < ApplicationController

    def serve
      path = File.join(AdminData.public_dir,params[:file])

      unless File.expand_path(path) =~ /admin_data/
        render :nothing => true, :status => 404 and return
      end

      opts = {:text => File.read(path), :cache => true}

      case params[:file]
      when /\.css$/i then opts[:content_type] = "text/css"
      when /\.js$/i then opts[:content_type] = "text/javascript"
      when /\.png$/i then opts[:content_type] = "image/png"
      else
        render :nothing => true, :status => 404 and return
      end

      render opts
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
admin_data-1.1.8 app/controllers/admin_data/public_controller.rb
admin_data-1.1.7 app/controllers/admin_data/public_controller.rb
admin_data-1.1.6 app/controllers/admin_data/public_controller.rb