Normalize line endings in form submissions

Fixes #506
This commit is contained in:
rubenwardy
2024-06-22 13:22:37 +01:00
parent d6e25f38a8
commit da090fd3f5
10 changed files with 29 additions and 21 deletions

View File

@@ -52,6 +52,13 @@ def nonempty_or_none(str):
return str
def normalize_line_endings(value: Optional[str]) -> Optional[str]:
if value is None:
return None
return value.replace("\r\n", "\n").strip() + "\n"
def should_return_json():
return "application/json" in request.accept_mimetypes and \
not "text/html" in request.accept_mimetypes