Reject illegal file attributes in remote evaluation
Remove ! from reject illegal file parameters
This commit is contained in:

committed by
Sebastian Serth

parent
ea029c5f1c
commit
1f3c9db537
@ -1,6 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module FileParameters
|
||||
def reject_illegal_file_attributes(exercise_id, params)
|
||||
if Exercise.exists?(id: exercise_id) && params
|
||||
params.reject do |_, file_attributes|
|
||||
file = CodeOcean::File.find_by(id: file_attributes[:file_id])
|
||||
file.nil? || file.hidden || file.read_only
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
private :reject_illegal_file_attributes
|
||||
|
||||
def file_attributes
|
||||
%w(content context_id feedback_message file_id file_type_id hidden id name native_file path read_only role weight file_template_id)
|
||||
%w[content context_id feedback_message file_id file_type_id hidden id name native_file path read_only role weight file_template_id]
|
||||
end
|
||||
private :file_attributes
|
||||
end
|
||||
|
Reference in New Issue
Block a user