You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/06/04 13:11:25 UTC

[incubator-ponymail-foal] 03/03: Magic number

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit bff694c46ce2bdf9fd0fd8ab509f2d5e706b82fe
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 4 14:11:10 2021 +0100

    Magic number
---
 server/plugins/formdata.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/server/plugins/formdata.py b/server/plugins/formdata.py
index 101ff72..73b5434 100644
--- a/server/plugins/formdata.py
+++ b/server/plugins/formdata.py
@@ -24,7 +24,8 @@ import urllib.parse
 import aiohttp.web
 import multipart
 
-PYPONY_MAX_PAYLOAD = 256 * 1024
+PYPONY_MAX_PAYLOAD_KB = 256
+PYPONY_MAX_PAYLOAD = PYPONY_MAX_PAYLOAD_KB * 1024
 ERRONEOUS_PAYLOAD = "Erroneous payload received"
 
 
@@ -40,7 +41,7 @@ async def parse_formdata(body_type, request: aiohttp.web.BaseRequest) -> dict:
                     request.content_length
                     and request.content_length > PYPONY_MAX_PAYLOAD
                 ):
-                    raise ValueError("Form data payload too large, max 256kb allowed")
+                    raise ValueError("Form data payload too large, max %dkb allowed" % PYPONY_MAX_PAYLOAD_KB)
                 body = await request.text()
                 if body_type == "json":
                     try: