Class: DownloadController

Inherits:
ApplicationController
  • Object
show all
Includes:
Blacklight::Catalog
Defined in:
app/controllers/download_controller.rb

Instance Method Summary collapse

Instance Method Details

#fileObject



33
34
35
36
37
38
# File 'app/controllers/download_controller.rb', line 33

def file
  # Grab the solr document to check if it should be public or not
  @document = search_service.fetch(file_name_to_id(params[:id]))
  restricted_should_authenticate
  send_file download_file_path_and_name, x_sendfile: true
end

#showObject



22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/download_controller.rb', line 22

def show
  @document = search_service.fetch params[:id]
  restricted_should_authenticate
  response = check_type
  validate response
  respond_to do |format|
    format.json { render json: [flash, download_file_path(response)], response: response }
    format.html { render json: [flash, download_file_path(response)], response: response }
  end
end