Sha256: 0ba88841dc27c55cc821238264fb80fd0c73938e468ec61f2f6d40575a51c48c

Contents?: true

Size: 516 Bytes

Versions: 25

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module VirusCheck
    extend ActiveSupport::Concern

    included do
      validate :must_not_detect_viruses

      def viruses?
        return false unless original_file&.new_record? # We have a new file to check
        VirusCheckerService.file_has_virus?(original_file)
      end

      def must_not_detect_viruses
        return true unless viruses?
        errors.add(:base, "Failed to verify uploaded file is not a virus")
        false
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/models/concerns/hyrax/virus_check.rb
hyrax-5.0.0 app/models/concerns/hyrax/virus_check.rb
hyrax-5.0.0.rc3 app/models/concerns/hyrax/virus_check.rb
hyrax-5.0.0.rc2 app/models/concerns/hyrax/virus_check.rb
hyrax-5.0.0.rc1 app/models/concerns/hyrax/virus_check.rb
hyrax-3.6.0 app/models/concerns/hyrax/virus_check.rb
hyrax-4.0.0 app/models/concerns/hyrax/virus_check.rb
hyrax-4.0.0.rc3 app/models/concerns/hyrax/virus_check.rb
hyrax-4.0.0.rc2 app/models/concerns/hyrax/virus_check.rb
hyrax-4.0.0.rc1 app/models/concerns/hyrax/virus_check.rb
hyrax-3.5.0 app/models/concerns/hyrax/virus_check.rb
hyrax-4.0.0.beta2 app/models/concerns/hyrax/virus_check.rb
hyrax-3.4.2 app/models/concerns/hyrax/virus_check.rb
hyrax-4.0.0.beta1 app/models/concerns/hyrax/virus_check.rb
hyrax-3.4.1 app/models/concerns/hyrax/virus_check.rb
hyrax-3.4.0 app/models/concerns/hyrax/virus_check.rb
hyrax-3.3.0 app/models/concerns/hyrax/virus_check.rb
hyrax-3.2.0 app/models/concerns/hyrax/virus_check.rb
hyrax-3.1.0 app/models/concerns/hyrax/virus_check.rb
hyrax-3.0.2 app/models/concerns/hyrax/virus_check.rb