diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 09bde5ddf..9bfa26580 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -601,8 +601,17 @@ class ProtocolsController < ApplicationController def protocolsio_import_create @protocolsio_too_big = false @protocolsio_invalid_file = false + @protocolsio_no_file = false + if params[:json_file].nil? + @protocolsio_no_file = true + respond_to do |format| + format.js {} + end + return 0 # return 0 stops the rest of the controller code from executing + end extension = File.extname(params[:json_file].path) file_size = File.size(params[:json_file].path) + if extension != '.txt' && extension != '.json' @protocolsio_invalid_file = true respond_to do |format| diff --git a/app/views/protocols/import_export/_import_json_protocol_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb index 1de9272c8..f6928dd40 100644 --- a/app/views/protocols/import_export/_import_json_protocol_modal.html.erb +++ b/app/views/protocols/import_export/_import_json_protocol_modal.html.erb @@ -18,6 +18,7 @@