X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fplugs%2Fparsers%2Fmultipart.ex;fp=lib%2Fpleroma%2Fweb%2Fplugs%2Fparsers%2Fmultipart.ex;h=6b5ab6af4fae0fbcf38dc014e5b894bf699b1a24;hb=07a48b9293e4046c50b5d424d60a1bf16c7cc198;hp=0000000000000000000000000000000000000000;hpb=7f4d218cffaafd97d9a5fe636a1acef7ca1053d8;p=akkoma diff --git a/lib/pleroma/web/plugs/parsers/multipart.ex b/lib/pleroma/web/plugs/parsers/multipart.ex new file mode 100644 index 000000000..6b5ab6af4 --- /dev/null +++ b/lib/pleroma/web/plugs/parsers/multipart.ex @@ -0,0 +1,21 @@ +defmodule Pleroma.Web.Plugs.Parsers.Multipart do + @multipart Plug.Parsers.MULTIPART + + alias Pleroma.Config + + def init(opts) do + opts + end + + def parse(conn, "multipart", subtype, headers, opts) do + length = 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