From 430ff39b72d75306f914e4a35453ff5d0394bf2c Mon Sep 17 00:00:00 2001 From: Kevin De Pelseneer Date: Mon, 9 Sep 2024 13:48:46 +0200 Subject: [PATCH] Raise error if linking method is not in approved linking methods --- app/controllers/samples_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/samples_controller.rb b/app/controllers/samples_controller.rb index b5ab07682e..cde6c4d694 100644 --- a/app/controllers/samples_controller.rb +++ b/app/controllers/samples_controller.rb @@ -343,6 +343,8 @@ def find_index_assets # @param template_attribute_title [String] the title of the template attribute to filter by # @return [Array] the filtered list of samples def filter_linked_samples(samples, link, options, template_attribute) + raise ArgumentError, "Invalid linking method provided. '#{link.to_s}' is not allowed!" unless %i[linked_samples linking_samples].include? link + template_attribute_title = template_attribute&.title samples.select do |s| s.send(link).any? do |x|