class FilePipeline::FileOperations::ExifRedaction

A FileOperation that will redact (delete) unwanted Exif tags from a file's metadata.

This could be tags containing sensitive data, such as e.g. GPS location data.

Caveat: if this operation is applied to a file together with ExifRestoration, it should be applied after the latter, to avoid redacted tags being restored.

Public Class Methods

new(options) click to toggle source

Returns a new instance.

Options
  • redact_tags - Exif tags to be deleted.

Calls superclass method
# File lib/file_pipeline/file_operations/default_operations/exif_redaction.rb, line 25
def initialize(**opts)
  defaults = { redact_tags: [] }
  super(opts, defaults)
end

Public Instance Methods

captured_data_tag() click to toggle source

Returns the REDACTED_EXIF_DATA tag defined in CapturedDataTags.

This operation will capture Exif tags and their values for any tags declared in options redact_tags.

# File lib/file_pipeline/file_operations/default_operations/exif_redaction.rb, line 34
def captured_data_tag
  CapturedDataTags::REDACTED_EXIF_DATA
end
operation(src_file, out_file) click to toggle source

Writes a new version of src_file to out_file with all Exif tags provided in the redact_tags option deleted.

Will return all deleted Exif tags and their values as data.

# File lib/file_pipeline/file_operations/default_operations/exif_redaction.rb, line 44
def operation(*args)
  src_file, out_file = args
  FileUtils.cp src_file, out_file
  delete_tags out_file, options[:redact_tags]
end