Merge branch 'szzh' of http://git.trustie.net/jacknudt/trustieforge into szzh
This commit is contained in:
commit
8ea626ec40
|
@ -17,6 +17,7 @@ class ZipdownController < ApplicationController
|
||||||
begin
|
begin
|
||||||
if params[:base64file]
|
if params[:base64file]
|
||||||
file = Base64.decode64(params[:base64file])
|
file = Base64.decode64(params[:base64file])
|
||||||
|
file = file.sub('*', '+')
|
||||||
send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file)
|
send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file)
|
||||||
else
|
else
|
||||||
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(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])
|
||||||
|
@ -118,11 +119,15 @@ class ZipdownController < ApplicationController
|
||||||
[{files:[out_file.file_path], count: 1, index: 1,
|
[{files:[out_file.file_path], count: 1, index: 1,
|
||||||
real_file: out_file.file_path,
|
real_file: out_file.file_path,
|
||||||
file: File.basename(out_file.file_path),
|
file: File.basename(out_file.file_path),
|
||||||
base64file: Base64.encode64(File.basename(out_file.file_path)),
|
base64file: encode64(File.basename(out_file.file_path)),
|
||||||
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def encode64(str)
|
||||||
|
Base64.encode64(str).sub('+', '*')
|
||||||
|
end
|
||||||
|
|
||||||
def zip_homework_common homework_common
|
def zip_homework_common homework_common
|
||||||
bid_homework_path = []
|
bid_homework_path = []
|
||||||
digests = []
|
digests = []
|
||||||
|
@ -142,7 +147,7 @@ class ZipdownController < ApplicationController
|
||||||
[{files:[out_file.file_path], count: 1, index: 1,
|
[{files:[out_file.file_path], count: 1, index: 1,
|
||||||
real_file: out_file.file_path,
|
real_file: out_file.file_path,
|
||||||
file: File.basename(out_file.file_path),
|
file: File.basename(out_file.file_path),
|
||||||
base64file: Base64.encode64(File.basename(out_file.file_path)),
|
base64file: encode64(File.basename(out_file.file_path)),
|
||||||
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue