Skip to content

Commit

Permalink
fix crash in endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek committed Jan 15, 2024
1 parent dcc54e1 commit 8bcd9fd
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/qrstorage_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ defmodule QrstorageWeb.Endpoint do
plug Plug.RequestId
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]

# account for deltas and overhead for the upload length. deltas are roughly the same size as the actual input,
# so * 2 for deltas, plus 0.2 buffer for overhead and text characters:
upload_length_buffer = 2.2
max_upload_length = String.to_integer(Application.get_env(:qrstorage, :max_upload_length))

plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library(),
length: ceil(max_upload_length * upload_length_buffer)
json_decoder: Phoenix.json_library()

plug Plug.MethodOverride
plug Plug.Head
Expand Down

0 comments on commit 8bcd9fd

Please sign in to comment.