Actually fix upload limit on OTP releases
authorrinpatch <rinpatch@sdf.org>
Fri, 7 Feb 2020 16:21:55 +0000 (19:21 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 8 Feb 2020 22:14:39 +0000 (01:14 +0300)
Closes #1109

lib/pleroma/plugs/parsers_plug.ex [deleted file]
lib/pleroma/web/endpoint.ex

diff --git a/lib/pleroma/plugs/parsers_plug.ex b/lib/pleroma/plugs/parsers_plug.ex
deleted file mode 100644 (file)
index 2e493ce..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Plugs.Parsers do
-  @moduledoc "Initializes Plug.Parsers with upload limit set at boot time"
-
-  @behaviour Plug
-
-  def init(_opts) do
-    Plug.Parsers.init(
-      parsers: [:urlencoded, :multipart, :json],
-      pass: ["*/*"],
-      json_decoder: Jason,
-      length: Pleroma.Config.get([:instance, :upload_limit]),
-      body_reader: {Pleroma.Web.Plugs.DigestPlug, :read_body, []}
-    )
-  end
-
-  defdelegate call(conn, opts), to: Plug.Parsers
-end
index f0abc8eb8657dc7d990ff0a70cdd9eb21a38ab9e..51c8401ae0bc15b7905e9300a855d7fe77a25519 100644 (file)
@@ -61,7 +61,17 @@ defmodule Pleroma.Web.Endpoint do
   plug(Plug.RequestId)
   plug(Plug.Logger)
 
-  plug(Pleroma.Plugs.Parsers)
+  plug(Plug.Parsers,
+    parsers: [
+      :urlencoded,
+      {:multipart, length: {Pleroma.Config, :get, [[:instance, :upload_limit]]}},
+      :json
+    ],
+    pass: ["*/*"],
+    json_decoder: Jason,
+    length: Pleroma.Config.get([:instance, :upload_limit]),
+    body_reader: {Pleroma.Web.Plugs.DigestPlug, :read_body, []}
+  )
 
   plug(Plug.MethodOverride)
   plug(Plug.Head)