Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85831888
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/priv/repo/migrations/20261027000000_upload_filter_exiftool_to_exif.exs b/priv/repo/migrations/20261027000000_upload_filter_exiftool_to_exif.exs
new file mode 100644
index 000000000..62392f957
--- /dev/null
+++ b/priv/repo/migrations/20261027000000_upload_filter_exiftool_to_exif.exs
@@ -0,0 +1,41 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2026 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExif do
+ use Ecto.Migration
+
+ alias Pleroma.ConfigDB
+
+ @up %{
+ Pleroma.Upload.Filter.Exiftool => Pleroma.Upload.Filter.Exif.StripLocation,
+ Pleroma.Upload.Filter.Exiftool.StripLocation => Pleroma.Upload.Filter.Exif.StripLocation,
+ Pleroma.Upload.Filter.Exiftool.ReadDescription => Pleroma.Upload.Filter.Exif.ReadDescription
+ }
+
+ @down %{
+ Pleroma.Upload.Filter.Exif.StripLocation => Pleroma.Upload.Filter.Exiftool.StripLocation,
+ Pleroma.Upload.Filter.Exif.ReadDescription => Pleroma.Upload.Filter.Exiftool.ReadDescription
+ }
+
+ def up, do: rename_filters(@up)
+
+ def down, do: rename_filters(@down)
+
+ defp rename_filters(renames) do
+ case ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) do
+ %{value: value} ->
+ new_value =
+ Keyword.update(value, :filters, [], fn filters ->
+ filters
+ |> Enum.map(&Map.get(renames, &1, &1))
+ |> Enum.uniq()
+ end)
+
+ ConfigDB.update_or_create(%{group: :pleroma, key: Pleroma.Upload, value: new_value})
+
+ _ ->
+ nil
+ end
+ end
+end
diff --git a/test/pleroma/repo/migrations/upload_filter_exiftool_to_exif_test.exs b/test/pleroma/repo/migrations/upload_filter_exiftool_to_exif_test.exs
new file mode 100644
index 000000000..9d39c6ea6
--- /dev/null
+++ b/test/pleroma/repo/migrations/upload_filter_exiftool_to_exif_test.exs
@@ -0,0 +1,64 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2026 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExifTest do
+ use Pleroma.DataCase
+ import Pleroma.Factory
+ import Pleroma.Tests.Helpers
+ alias Pleroma.ConfigDB
+
+ setup_all do: require_migration("20261027000000_upload_filter_exiftool_to_exif")
+
+ defp filters do
+ ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value[:filters]
+ end
+
+ test "up/0 renames the Exiftool filters", %{migration: migration} do
+ insert(:config,
+ group: :pleroma,
+ key: Pleroma.Upload,
+ value: [
+ filters: [
+ Pleroma.Upload.Filter.Dedupe,
+ Pleroma.Upload.Filter.Exiftool,
+ Pleroma.Upload.Filter.Exiftool.StripLocation,
+ Pleroma.Upload.Filter.Exiftool.ReadDescription
+ ]
+ ]
+ )
+
+ migration.up()
+
+ assert filters() == [
+ Pleroma.Upload.Filter.Dedupe,
+ Pleroma.Upload.Filter.Exif.StripLocation,
+ Pleroma.Upload.Filter.Exif.ReadDescription
+ ]
+ end
+
+ test "down/0 restores the Exiftool filters", %{migration: migration} do
+ insert(:config,
+ group: :pleroma,
+ key: Pleroma.Upload,
+ value: [
+ filters: [
+ Pleroma.Upload.Filter.Exif.StripLocation,
+ Pleroma.Upload.Filter.Exif.ReadDescription
+ ]
+ ]
+ )
+
+ migration.down()
+
+ assert filters() == [
+ Pleroma.Upload.Filter.Exiftool.StripLocation,
+ Pleroma.Upload.Filter.Exiftool.ReadDescription
+ ]
+ end
+
+ test "up/0 does nothing without a database config", %{migration: migration} do
+ assert migration.up() == nil
+ assert ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) == nil
+ end
+end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Nov 1, 11:49 PM (13 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1803432
Default Alt Text
(3 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline