projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c67cf8e
)
do the filtering
author
Tristan Mahé
<gled@remote-shell.net>
Tue, 26 Jun 2018 21:03:23 +0000
(14:03 -0700)
committer
Tristan Mahé
<gled@remote-shell.net>
Tue, 26 Jun 2018 21:03:23 +0000
(14:03 -0700)
lib/pleroma/upload.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/upload.ex
b/lib/pleroma/upload.ex
index e412e43fa5add67660e7883cffda5cd9089c85a0..1640c1f9cccc9d3e7544e8d761f6e43d09e7a00c 100644
(file)
--- 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
File.cp!(file.path, result_file)
end
+ strip_exif_data(content_type, file.path)
+
%{
"type" => "Image",
"url" => [
%{
"type" => "Image",
"url" => [
@@
-67,6
+69,8
@@
defmodule Pleroma.Upload do
File.rename(uuidpath, result_file)
end
File.rename(uuidpath, result_file)
end
+ strip_exif_data(content_type, uuidpath)
+
%{
"type" => "Image",
"url" => [
%{
"type" => "Image",
"url" => [
@@
-80,11
+84,12
@@
defmodule Pleroma.Upload do
}
end
}
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)
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
Mogrify.open(file) |> Mogrify.custom("strip") |> Mogrify.save(in_place: true)
end
end