From 851d4ce22aa1417033565352b84b18950df15400 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 17 Jun 2017 01:04:16 -0400 Subject: [PATCH] Properly quote reason header so non-ASCII works in audit log reasons. --- discord/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/discord/http.py b/discord/http.py index 41133562a..41bc25654 100644 --- a/discord/http.py +++ b/discord/http.py @@ -32,6 +32,7 @@ import logging import weakref import datetime from email.utils import parsedate_to_datetime +from urllib.parse import quote as _uriquote log = logging.getLogger(__name__) @@ -130,7 +131,7 @@ class HTTPClient: pass else: if reason: - headers['X-Audit-Log-Reason'] = reason + headers['X-Audit-Log-Reason'] = _uriquote(reason, safe='/ ') kwargs['headers'] = headers