|
|
|
@ -11,7 +11,7 @@ class ZipdownController < ApplicationController
|
|
|
|
|
def download
|
|
|
|
|
if User.current.logged?
|
|
|
|
|
begin
|
|
|
|
|
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => params[:filename], :type => detect_content_type(params[:file])
|
|
|
|
|
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file])
|
|
|
|
|
rescue => e
|
|
|
|
|
render file: 'public/no_file_found.html'
|
|
|
|
|
end
|
|
|
|
@ -59,9 +59,10 @@ class ZipdownController < ApplicationController
|
|
|
|
|
if homework != nil
|
|
|
|
|
unless homework.attachments.empty?
|
|
|
|
|
zipfile = zip_homework_by_user homework
|
|
|
|
|
send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) +
|
|
|
|
|
"_" + homework.user.show_name +
|
|
|
|
|
"_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile)
|
|
|
|
|
filename = ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) +
|
|
|
|
|
"_" + homework.user.show_name +
|
|
|
|
|
"_" + homework.name + ".zip"
|
|
|
|
|
send_file zipfile.file_path, :filename => filename_for_content_disposition(filename), :type => detect_content_type(zipfile.file_path) if(zipfile)
|
|
|
|
|
else
|
|
|
|
|
render file: 'public/no_file_found.html'
|
|
|
|
|
end
|
|
|
|
|