diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index c73e0298b2..30bdfa41d3 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -907,8 +907,8 @@ def export_protocol_file_name(protocols) if protocols.count == 1 file_name = 'protocol.eln' unless protocol_name.nil? - escaped_name = protocol_name.gsub(/[^0-9a-zA-Z\-.,_]/i, '_') - .downcase[0..Constants::NAME_MAX_LENGTH] + escaped_name = ActiveStorage::Filename.new(protocol_name).sanitized.to_s + .downcase[0..Constants::NAME_MAX_LENGTH] file_name = escaped_name + '.eln' unless escaped_name.blank? end elsif protocols.length > 1