Class: TestServer::FileUploaderController
Instance Method Summary
collapse
Methods included from WebHelper
#configure_caching, #encode, #generate_eicar, #generate_random_string, #generate_string
Instance Method Details
#index ⇒ Object
32
33
|
# File 'app/controllers/test_server/file_uploader_controller.rb', line 32
def index
end
|
#result ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/test_server/file_uploader_controller.rb', line 9
def result
add_breadcrumb I18n.t('views.file_uploader.upload.link'), :file_uploader_upload_path
@file_upload = FileUpload.new(params.fetch(:test_server_file_upload, {}))
operations = []
operations << VirusDetector.new if @file_upload.virus_scan == true
operations << FiletypeDetector.new if @file_upload.filetype_detection == true
if @file_upload.checksum_calculation == true
operations << Sha256Calculator.new
operations << MD5Calculator.new
end
operations << FileDeleter.new
operations.each do |d|
d.use @file_upload.uploaded_file
end
add_breadcrumb I18n.t('views.file_uploader.result.link', file: html_escape(@file_upload.uploaded_file.name))
end
|
#upload ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'app/controllers/test_server/file_uploader_controller.rb', line 35
def upload
add_breadcrumb I18n.t('views.file_uploader.upload.link'), :file_uploader_upload_path
@file_upload = FileUpload.new
@file_upload.virus_scan = false
@file_upload.filetype_detection = false
@file_upload.checksum_calculation = false
end
|