Merge branch 'fix/otp-parsers' into 'develop'
OTP: Fix runtime upload limit config being ignored Closes #1109 See merge request pleroma/pleroma!2045
This commit is contained in:
commit
0d2c13a119
21
lib/pleroma/plugs/parsers_plug.ex
Normal file
21
lib/pleroma/plugs/parsers_plug.ex
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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
|
@ -61,14 +61,7 @@ defmodule Pleroma.Web.Endpoint do
|
|||||||
plug(Plug.RequestId)
|
plug(Plug.RequestId)
|
||||||
plug(Plug.Logger)
|
plug(Plug.Logger)
|
||||||
|
|
||||||
plug(
|
plug(Pleroma.Plugs.Parsers)
|
||||||
Plug.Parsers,
|
|
||||||
parsers: [:urlencoded, :multipart, :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.MethodOverride)
|
||||||
plug(Plug.Head)
|
plug(Plug.Head)
|
||||||
|
Loading…
Reference in New Issue
Block a user