Skip to content

Commit

Permalink
Rails 5 file validator need guard for nil
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartin-tech committed Jul 31, 2020
1 parent 07cbe42 commit d13c463
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/validators/metasploit/framework/file_path_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Framework
class FilePathValidator < ActiveModel::EachValidator

def validate_each(record, attribute, value)
unless ::File.file? value
unless value && ::File.file?(value)
record.errors[attribute] << (options[:message] || "is not a valid path to a regular file")
end
end
Expand Down

0 comments on commit d13c463

Please sign in to comment.