Class: AppealSubmissionUpload

Inherits:
ApplicationRecord show all
Defined in:
app/models/appeal_submission_upload.rb

Constant Summary collapse

MASK_REGEX =

Matches all characters except first 3 characters, last 6 characters (2 + .pdf extension), underscores, and hyphens

/(?<=.{3})[^_-](?=.{6})/

Instance Method Summary collapse

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Instance Method Details

#masked_attachment_filenameObject



18
19
20
21
22
23
# File 'app/models/appeal_submission_upload.rb', line 18

def masked_attachment_filename
  filename = JSON.parse(decision_review_evidence_attachment&.file_data || '{}')['filename']
  raise 'Filename for AppealSubmissionUpload not found' if filename.nil?

  filename.gsub(MASK_REGEX, 'X')
end