X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Fupload%2Ffilter%2Fanonymize_filename.ex;h=7e62b3d136e046ab728617d1954cd6a04008a384;hb=595bca24ad79bf058ea6319f26b1ef643e6b7a10;hp=a8516811ce666bb53d4d2c556892d0c6ca626cc0;hpb=a7994185739522dee80e22f76e5fdac1a3b8279b;p=akkoma
diff --git a/lib/pleroma/upload/filter/anonymize_filename.ex b/lib/pleroma/upload/filter/anonymize_filename.ex
index a8516811c..7e62b3d13 100644
--- a/lib/pleroma/upload/filter/anonymize_filename.ex
+++ b/lib/pleroma/upload/filter/anonymize_filename.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.AnonymizeFilename do
@@ -16,9 +16,11 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilename do
def filter(%Upload{name: name} = upload) do
extension = List.last(String.split(name, "."))
name = predefined_name(extension) || random(extension)
- {:ok, %Upload{upload | name: name}}
+ {:ok, :filtered, %Upload{upload | name: name}}
end
+ def filter(_), do: {:ok, :noop}
+
@spec predefined_name(String.t()) :: String.t() | nil
defp predefined_name(extension) do
with name when not is_nil(name) <- Config.get([__MODULE__, :text]),