Skip to contentSkip to conversation

settings: Increase maximum upload size

PATCH New Mathieu Dubois-Briand 1 participant 3 messages Feb 13

lore
Share & tools
lore
#0 lore raw

cover settings: Increase maximum upload size

Fixing errors on the "Sending error reports" step of recent a-full builds with long failure logs.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=16165

---
Mathieu Dubois-Briand (2):
views: Return descriptive error on too big request
settings: Increase maximum upload size

 Post/views.py       | 8 ++++++--
 project/settings.py | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

---
base-commit: 88b1f10aa3ca477ba28f6a2497d0c8bbe4d85642
change-id: 20260213-mathieu-too-big-data-cb20910bde45

Best regards,

Signature · 1 line
Mathieu Dubois-Briand <[email protected]>
#1 lore raw

PATCH 1/2 views: Return descriptive error on too big request

Return descriptive error when client requests are too big in regard of configured maximum request size. This should be easier too debug than a generic 500 HTTP error.

---
 Post/views.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Post/views.py +6 -2
index c294afdbee03..89a57cf50a88 100644
@@ -19,7 +19,7 @@ from Post.parser import Parser
 from django.conf import settings
 from Post.createStatistics import Statistics
 from django.core.paginator import Paginator, EmptyPage
-from django.core.exceptions import FieldError, ObjectDoesNotExist
+from django.core.exceptions import FieldError, ObjectDoesNotExist, RequestDataTooBig
 from django.http import JsonResponse
 from django.db.models import Q
 import json
@@ -59,7 +59,11 @@ def addData(request, return_json=False):
             version = m.group(1)
             version_parts = [int(part) for part in version.split('.')]
         if version_parts and version_parts >= [0, 3]:
-            data = request.body
+            try:
+                data = request.body
+            except RequestDataTooBig:
+                response = HttpResponse("Request content is too big", status=413)
+                return response
         else:
             # Backward compatibility with send-error-report < 0.3
             # The json is url encoded so we need to undo this here.
Signature · 1 line
2.47.3
#2 lore raw

PATCH 2/2 settings: Increase maximum upload size

In reply to Mathieu Dubois-Briand

Raising from default 5MB to 10 MB.

Fixes [YOCTO #16165]

---
 project/settings.py | 2 ++
 1 file changed, 2 insertions(+)
project/settings.py +2 -0
index d0d8279ac40c..33d8ef9dd186 100644
@@ -206,3 +206,5 @@ LOGIN_REDIRECT_URL = '/Errors'
 
 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
 DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
+
+DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760
Signature · 1 line
2.47.3