From 44574336d3cfad6162ffbd92d240b9d99bb6ba98 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Wed, 8 May 2024 21:29:53 +0530 Subject: [PATCH] Remove erroneous substituions from file names --- hyrax/app/models/hyrax/uploaded_file.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyrax/app/models/hyrax/uploaded_file.rb b/hyrax/app/models/hyrax/uploaded_file.rb index 24187e79..2d1f25c6 100644 --- a/hyrax/app/models/hyrax/uploaded_file.rb +++ b/hyrax/app/models/hyrax/uploaded_file.rb @@ -51,8 +51,8 @@ module Hyrax parsed_file = YAML.load_file(Rails.root.join('config', 'restricted_files.yml')) file_name = file.file.original_filename - - if parsed_file['restricted_file_names'].include?(file_name.gsub(/[\s_\-]/, '').downcase) + + if parsed_file['restricted_file_names'].include?(file_name) || parsed_file['restricted_file_names'].include?(file_name.downcase) errors.add(:base, "This file name is restricted.") end end -- GitLab