Merge pull request #8434 from gbm001/develop
fix: Non-ASCII characters in HTTP headers.
This commit is contained in:
commit
2372bf3f4e
1 changed files with 2 additions and 2 deletions
|
|
@ -125,12 +125,12 @@ def build_response(path, data, http_status_code, headers=None):
|
|||
response = Response()
|
||||
response.data = set_content_type(response, data, path)
|
||||
response.status_code = http_status_code
|
||||
response.headers["X-Page-Name"] = path.encode("utf-8")
|
||||
response.headers["X-Page-Name"] = path.encode("ascii", errors="xmlcharrefreplace")
|
||||
response.headers["X-From-Cache"] = frappe.local.response.from_cache or False
|
||||
|
||||
if headers:
|
||||
for key, val in iteritems(headers):
|
||||
response.headers[key] = val.encode("utf-8")
|
||||
response.headers[key] = val.encode("ascii", errors="xmlcharrefreplace")
|
||||
|
||||
return response
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue