summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-04-02 07:48:35 +0000
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-04-02 07:48:35 +0000
commita466d97e62a89b320713da44d67d452284ad8282 (patch)
tree58f9b4a2cf07ebc875c6e9ba6168361dcb5773ae /lib/tasks
parent6557858faeb5ae56d18a2f4463d43e0bc22d700f (diff)
downloadgitlab-ce-a466d97e62a89b320713da44d67d452284ad8282.tar.gz
Rake task for removing exif from uploads
Adds a rake task which can be used for removing EXIF data from existing uploads.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/uploads/sanitize.rake18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/uploads/sanitize.rake b/lib/tasks/gitlab/uploads/sanitize.rake
new file mode 100644
index 00000000000..12cf5302555
--- /dev/null
+++ b/lib/tasks/gitlab/uploads/sanitize.rake
@@ -0,0 +1,18 @@
+namespace :gitlab do
+ namespace :uploads do
+ namespace :sanitize do
+ desc 'GitLab | Uploads | Remove EXIF from images.'
+ task :remove_exif, [:start_id, :stop_id, :dry_run, :sleep_time] => :environment do |task, args|
+ args.with_defaults(dry_run: 'true')
+ args.with_defaults(sleep_time: 0.3)
+
+ logger = Logger.new(STDOUT)
+
+ sanitizer = Gitlab::Sanitizers::Exif.new(logger: logger)
+ sanitizer.batch_clean(start_id: args.start_id, stop_id: args.stop_id,
+ dry_run: args.dry_run != 'false',
+ sleep_time: args.sleep_time.to_f)
+ end
+ end
+ end
+end