aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/multipart.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/multipart.ex')
-rw-r--r--lib/pleroma/web/multipart.ex22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/pleroma/web/multipart.ex b/lib/pleroma/web/multipart.ex
new file mode 100644
index 0000000..e24bb14
--- /dev/null
+++ b/lib/pleroma/web/multipart.ex
@@ -0,0 +1,22 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+# <https://hexdocs.pm/plug/Plug.Parsers.MULTIPART.html#module-dynamic-configuration>
+defmodule Pleroma.Web.Multipart do
+ @multipart Plug.Parsers.MULTIPART
+
+ def init(opts) do
+ opts
+ end
+
+ def parse(conn, "multipart", subtype, headers, opts) do
+ length = Pleroma.Config.get([:instance, :upload_limit])
+ opts = @multipart.init([length: length] ++ opts)
+ @multipart.parse(conn, "multipart", subtype, headers, opts)
+ end
+
+ def parse(conn, _type, _subtype, _headers, _opts) do
+ {:next, conn}
+ end
+end