diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c6dd7830c..ee876c2c9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -52,7 +52,7 @@ class UsersController < ApplicationController def attachment_show file_name = params[:file_name] - path = params[:path] + path = params[:path] || edu_setting('attachment_folder') send_file "#{path}/#{file_name}", :filename => "#{file_name}", :type => 'game', :disposition => 'attachment' #inline can open in browser diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder index 85cdee1e5..b30869d57 100644 --- a/app/views/attachments/_attachment.json.jbuilder +++ b/app/views/attachments/_attachment.json.jbuilder @@ -15,4 +15,4 @@ json.created_on attachment.created_on json.content_type attachment.content_type json.is_pdf attachment.is_pdf? json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment) -json.play_url absolute_path(local_path(attachment)) +json.play_url attachment_show_users_path(file_name: local_path(attachment))