aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTristan Mahé <gled@remote-shell.net>2018-06-26 14:03:23 -0700
committerTristan Mahé <gled@remote-shell.net>2018-06-26 14:03:23 -0700
commitd8d43f1173aaea677a74aee6315d1195d59197e3 (patch)
treebdea371903b8ba90bf5d737a4d6b22a8da84190a /lib
parentc67cf8e9af3ab9b52f34387a686a68ee4e1554b4 (diff)
downloadpleroma-d8d43f1173aaea677a74aee6315d1195d59197e3.tar.gz
do the filtering
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/upload.ex9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex
index e412e43fa..1640c1f9c 100644
--- a/lib/pleroma/upload.ex
+++ b/lib/pleroma/upload.ex
@@ -18,6 +18,8 @@ defmodule Pleroma.Upload do
File.cp!(file.path, result_file)
end
+ strip_exif_data(content_type, file.path)
+
%{
"type" => "Image",
"url" => [
@@ -67,6 +69,8 @@ defmodule Pleroma.Upload do
File.rename(uuidpath, result_file)
end
+ strip_exif_data(content_type, uuidpath)
+
%{
"type" => "Image",
"url" => [
@@ -80,11 +84,12 @@ defmodule Pleroma.Upload do
}
end
- def strip_exif_data(file) do
+ def strip_exif_data(content_type, file) do
settings = Application.get_env(:pleroma, Pleroma.Upload)
@do_strip = Keyword.fetch!(settings, :strip_exif)
+ [filetype, ext] = String.split(content_type, "/")
- if @do_strip == true do
+ if filetype == "image" and @do_strip == true do
Mogrify.open(file) |> Mogrify.custom("strip") |> Mogrify.save(in_place: true)
end
end