Module: Shrine::Plugins::ValidateUnlockedPdf::AttacherMethods
- Defined in:
- lib/shrine/plugins/validate_unlocked_pdf.rb
Instance Method Summary collapse
Instance Method Details
#validate_unlocked_pdf ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/shrine/plugins/validate_unlocked_pdf.rb', line 9 def validate_unlocked_pdf return unless get.mime_type == Mime[:pdf].to_s cached_path = get.download = PdfInfo::Metadata.read(cached_path) errors << I18n.t('errors.messages.uploads.pdf.locked') if .encrypted? rescue PdfInfo::MetadataReadError errors << I18n.t('errors.messages.uploads.pdf.invalid') end |