aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-02-07 19:21:55 +0300
committerrinpatch <rinpatch@sdf.org>2020-02-09 01:14:39 +0300
commit1e3dda9b1dc25152483e6185ce7a3365f9810209 (patch)
tree9f48a06b59c447aa58d5acb8e620e3fff0e6c441
parentbe3cdde9db1375103a1ea318d702181d81142fb8 (diff)
downloadpleroma-1e3dda9b1dc25152483e6185ce7a3365f9810209.tar.gz
Actually fix upload limit on OTP releases
Closes #1109
-rw-r--r--lib/pleroma/plugs/parsers_plug.ex21
-rw-r--r--lib/pleroma/web/endpoint.ex12
2 files changed, 11 insertions, 22 deletions
diff --git a/lib/pleroma/plugs/parsers_plug.ex b/lib/pleroma/plugs/parsers_plug.ex
deleted file mode 100644
index 2e493ce0e..000000000
--- a/lib/pleroma/plugs/parsers_plug.ex
+++ /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
diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex
index f0abc8eb8..51c8401ae 100644
--- a/lib/pleroma/web/endpoint.ex
+++ b/lib/pleroma/web/endpoint.ex
@@ -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)