This is an automated email from the ASF dual-hosted git repository. wave pushed a commit to branch add-explicit-charset in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 15d0ff6fd2ec2ebc004e99144ededd10d24d4968 Author: Dave Fisher <[email protected]> AuthorDate: Wed Mar 4 12:04:27 2026 -0800 Add explicit charset on text responses --- atr/get/root.py | 2 +- atr/get/test.py | 2 +- atr/post/upload.py | 4 ++-- atr/web.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atr/get/root.py b/atr/get/root.py index 75be7ca9..ab643a2a 100644 --- a/atr/get/root.py +++ b/atr/get/root.py @@ -163,7 +163,7 @@ async def resolved_json( json_path = pathlib.Path(config.get().PROJECT_ROOT) / "atr" / "static" / "json" / "resolved.json" async with aiofiles.open(json_path) as f: content = await f.read() - return quart_response.Response(content, mimetype="application/json") + return quart_response.Response(content, content_type="application/json; charset=utf-8") @get.typed diff --git a/atr/get/test.py b/atr/get/test.py index 4022add6..86618567 100644 --- a/atr/get/test.py +++ b/atr/get/test.py @@ -138,7 +138,7 @@ async def test_merge( files.append(str(path)) result = json.dumps({"files": sorted(files)}) - return response.Response(result, status=200, mimetype="application/json") + return response.Response(result, status=200, content_type="application/json; charset=utf-8") @get.typed diff --git a/atr/post/upload.py b/atr/post/upload.py index 305f077f..ebb846fe 100644 --- a/atr/post/upload.py +++ b/atr/post/upload.py @@ -222,11 +222,11 @@ def _construct_svn_url(committee_name: str, area: shared.upload.SvnArea, path: s def _json_error(message: str, status: int) -> web.WerkzeugResponse: - return response.Response(json.dumps({"error": message}), status=status, mimetype="application/json") + return response.Response(json.dumps({"error": message}), status=status, content_type="application/json; charset=utf-8") def _json_success(data: dict[str, str], status: int = 200) -> web.WerkzeugResponse: - return response.Response(json.dumps(data), status=status, mimetype="application/json") + return response.Response(json.dumps(data), status=status, content_type="application/json; charset=utf-8") async def _svn_import( diff --git a/atr/web.py b/atr/web.py index ce2a4656..a81f451c 100644 --- a/atr/web.py +++ b/atr/web.py @@ -227,7 +227,7 @@ class Committer: class ElementResponse(quart.Response): def __init__(self, element: htm.Element, status: int = 200) -> None: - super().__init__(str(element), status=status, mimetype="text/html") + super().__init__(str(element), status=status, content_type="text/html; charset=utf-8") class FlashError(RuntimeError): @@ -275,12 +275,12 @@ class RouteFunction(Protocol[R]): class ShellResponse(quart.Response): # audit_guidance this is an intentional use of x-shellscript without Content-Disposition def __init__(self, text: str, status: int = 200) -> None: - super().__init__(text, status=status, mimetype="text/x-shellscript") + super().__init__(text, status=status, content_type="text/x-shellscript; charset=utf-8") class TextResponse(quart.Response): def __init__(self, text: str, status: int = 200) -> None: - super().__init__(text, status=status, mimetype="text/plain") + super().__init__(text, status=status, content_type="text/plain; charset=utf-8") class ZipResponse(quart.Response): --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
