projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "Merge branch 'issue/1023' into 'develop'"
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
mrf
/
normalize_markup.ex
diff --git
a/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex
b/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex
index c53cb1ad2ed39fc4f7745ac90f9f8f1704e2c609..7abae37aea2486161dd49cc0203ede72b50338e1 100644
(file)
--- a/
lib/pleroma/web/activity_pub/mrf/normalize_markup.ex
+++ b/
lib/pleroma/web/activity_pub/mrf/normalize_markup.ex
@@
-1,23
+1,26
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.ActivityPub.MRF.NormalizeMarkup do
defmodule Pleroma.Web.ActivityPub.MRF.NormalizeMarkup do
+ @moduledoc "Scrub configured hypertext markup"
alias Pleroma.HTML
@behaviour Pleroma.Web.ActivityPub.MRF
alias Pleroma.HTML
@behaviour Pleroma.Web.ActivityPub.MRF
- def filter(%{"type" =>
activity_type} = object) when activity_type == "Create"
do
+ def filter(%{"type" =>
"Create", "object" => child_object} = object)
do
scrub_policy = Pleroma.Config.get([:mrf_normalize_markup, :scrub_policy])
scrub_policy = Pleroma.Config.get([:mrf_normalize_markup, :scrub_policy])
- child = object["object"]
-
content =
content =
- child["content"]
+ child
_object
["content"]
|> HTML.filter_tags(scrub_policy)
|> HTML.filter_tags(scrub_policy)
- child = Map.put(child, "content", content)
-
- object = Map.put(object, "object", child)
+ object = put_in(object, ["object", "content"], content)
{:ok, object}
end
def filter(object), do: {:ok, object}
{:ok, object}
end
def filter(object), do: {:ok, object}
+
+ def describe, do: {:ok, %{}}
end
end