app/controllers/dradis/plugins/csv/upload_controller.rb in dradis-csv-4.8.0 vs app/controllers/dradis/plugins/csv/upload_controller.rb in dradis-csv-4.9.0

- old
+ new

@@ -28,19 +28,13 @@ def job_logger @job_logger ||= Log.new(uid: params[:log_uid].to_i) end - def load_rtp_fields - rtp = current_project.report_template_properties - @rtp_fields = - unless rtp.nil? - { - evidence: rtp.evidence_fields.map(&:name), - issue: rtp.issue_fields.map(&:name) - } - end + def load_attachment + filename = CGI::escape params[:attachment] + @attachment = Attachment.find(filename, conditions: { node_id: current_project.plugin_uploads_node.id }) end def load_csv_headers begin unless File.extname(@attachment.fullpath) == '.csv' @@ -53,11 +47,18 @@ rescue Dradis::Plugins::CSV::FileExtensionError return redirect_to main_app.project_upload_manager_path, alert: "The uploaded file is not a CSV file." end end - def load_attachment - @attachment = Attachment.find(params[:attachment], conditions: { node_id: current_project.plugin_uploads_node.id }) + def load_rtp_fields + rtp = current_project.report_template_properties + @rtp_fields = + unless rtp.nil? + { + evidence: rtp.evidence_fields.map(&:name), + issue: rtp.issue_fields.map(&:name) + } + end end def mappings_params params.require(:mappings).permit(field_attributes: [:field, :type]) end