# class BlobController

Controller for viewing a file’s blame

### Public Instance Methods

show() click to toggle source

    # File app/controllers/blob_controller.rb, line 13
    def show
      if @tree.is_blob?
        if @tree.text?
          encoding = detect_encoding(@tree.data)
          mime_type = encoding ? "text/plain; charset=#{encoding}" : "text/plain"
        else
          mime_type = @tree.mime_type
        end

        send_data(
          @tree.data,
          type: mime_type,
          disposition: 'inline',
          filename: @tree.name
        )
      else
        not_found!
      end
    end