Set a maximum length of 524288 characters for text messages in Receive mode

This commit is contained in:
Miguel Jacq 2024-02-16 15:24:47 +11:00
parent ad69fa55db
commit 35670533d8
No known key found for this signature in database
GPG key ID: 59B3F0C24135C6A9
2 changed files with 6 additions and 3 deletions

View file

@ -194,7 +194,10 @@ class ReceiveModeWeb:
if files_received > 0:
msg = f"Uploaded {files_msg}"
else:
msg = "Nothing submitted"
if not self.web.settings.get("receive", "disable_text"):
msg = "Nothing submitted or message was too long (> 524288 characters)"
else:
msg = "Nothing submitted"
if ajax:
info_flashes.append(msg)
@ -462,7 +465,7 @@ class ReceiveModeRequest(Request):
self.includes_message = False
if not self.web.settings.get("receive", "disable_text"):
text_message = self.form.get("text")
if text_message:
if text_message and len(text_message) <= 524288:
if text_message.strip() != "":
self.includes_message = True