Sha256: ab167e5ee66fd11709a11c6218fd284093a8edbf86fd5613000d20189d7609fc

Contents?: true

Size: 366 Bytes

Versions: 248

Compression:

Stored size: 366 Bytes

Contents

module Katello
  module Validators
    class ContentValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, value)
        value.encode("UTF-8", 'binary') unless value.blank?
      rescue Encoding::UndefinedConversionError
        record.errors[attribute] << (options[:message] || _("cannot be a binary file."))
      end
    end
  end
end

Version data entries

248 entries across 248 versions & 1 rubygems

Version Path
katello-4.14.2 app/lib/katello/validators/content_validator.rb
katello-4.15.0 app/lib/katello/validators/content_validator.rb
katello-4.15.0.rc2 app/lib/katello/validators/content_validator.rb
katello-4.15.0.rc1 app/lib/katello/validators/content_validator.rb
katello-4.14.1 app/lib/katello/validators/content_validator.rb
katello-4.14.0 app/lib/katello/validators/content_validator.rb
katello-4.14.0.rc3 app/lib/katello/validators/content_validator.rb
katello-4.14.0.rc2 app/lib/katello/validators/content_validator.rb
katello-4.14.0.rc1.1 app/lib/katello/validators/content_validator.rb
katello-4.14.0.rc1 app/lib/katello/validators/content_validator.rb
katello-4.13.1 app/lib/katello/validators/content_validator.rb
katello-4.13.0 app/lib/katello/validators/content_validator.rb
katello-4.12.1 app/lib/katello/validators/content_validator.rb
katello-4.13.0.rc1 app/lib/katello/validators/content_validator.rb
katello-4.12.0 app/lib/katello/validators/content_validator.rb
katello-4.12.0.rc3 app/lib/katello/validators/content_validator.rb
katello-4.12.0.rc2 app/lib/katello/validators/content_validator.rb
katello-4.12.0.rc1 app/lib/katello/validators/content_validator.rb
katello-4.11.1 app/lib/katello/validators/content_validator.rb
katello-4.11.0 app/lib/katello/validators/content_validator.rb