Skip to content

Commit

Permalink
Fix example for Plug.Parsers.MULTIPART dynamic configuration (#1113)
Browse files Browse the repository at this point in the history
Plug.Parsers.MULTIPART expects a number as length. The following error
is raised if a binary is passed

** (Plug.Parsers.ParseError) malformed request, a ArithmeticError exception was raised with message "bad argument in arithmetic expression"
    :erlang.-("100000000", 1142962)
  • Loading branch information
edgurgel committed Aug 5, 2022
1 parent 6dec4e3 commit 254f517
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/plug/parsers/multipart.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ defmodule Plug.Parsers.MULTIPART do
end
def parse(conn, "multipart", subtype, headers, opts) do
length = System.fetch_env!("UPLOAD_LIMIT")
length = System.fetch_env!("UPLOAD_LIMIT") |> String.to_integer
opts = @multipart.init([length: length] ++ opts)
@multipart.parse(conn, "multipart", subtype, headers, opts)
end
Expand Down

0 comments on commit 254f517

Please sign in to comment.