mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Merge pull request #7918 from ryanpetrello/surro-get-outta-here
make event stdout encoding more resilient to UTF-16 surrogate pairs Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
d452c1d7a9
@ -9,6 +9,7 @@ This is a list of high-level changes for each release of AWX. A full list of com
|
||||
- Upgraded git-python to fix a bug that caused workflows to sometimes fail - https://github.com/ansible/awx/issues/6119
|
||||
- Fixed a bug in the AWX CLI that prevented Workflow nodes from importing properly - https://github.com/ansible/awx/issues/7793
|
||||
- Fixed a bug in the awx.awx collection release process that templated the wrong version - https://github.com/ansible/awx/issues/7870
|
||||
- Fixed a bug that caused errors rendering stdout that contained UTF-16 surrogate pairs - https://github.com/ansible/awx/pull/7918
|
||||
|
||||
## 14.0.0 (Aug 6, 2020)
|
||||
- As part of our commitment to inclusivity in open source, we recently took some time to audit AWX's source code and user interface and replace certain terminology with more inclusive language. Strictly speaking, this isn't a bug or a feature, but we think it's important and worth calling attention to:
|
||||
|
||||
@ -7,6 +7,24 @@ from prometheus_client.parser import text_string_to_metric_families
|
||||
# Django REST Framework
|
||||
from rest_framework import renderers
|
||||
from rest_framework.request import override_method
|
||||
from rest_framework.utils import encoders
|
||||
|
||||
|
||||
class SurrogateEncoder(encoders.JSONEncoder):
|
||||
|
||||
def encode(self, obj):
|
||||
ret = super(SurrogateEncoder, self).encode(obj)
|
||||
try:
|
||||
ret.encode()
|
||||
except UnicodeEncodeError as e:
|
||||
if 'surrogates not allowed' in e.reason:
|
||||
ret = ret.encode('utf-8', 'replace').decode()
|
||||
return ret
|
||||
|
||||
|
||||
class DefaultJSONRenderer(renderers.JSONRenderer):
|
||||
|
||||
encoder_class = SurrogateEncoder
|
||||
|
||||
|
||||
class BrowsableAPIRenderer(renderers.BrowsableAPIRenderer):
|
||||
|
||||
@ -310,7 +310,7 @@ REST_FRAMEWORK = {
|
||||
'awx.api.parsers.JSONParser',
|
||||
),
|
||||
'DEFAULT_RENDERER_CLASSES': (
|
||||
'rest_framework.renderers.JSONRenderer',
|
||||
'awx.api.renderers.DefaultJSONRenderer',
|
||||
'awx.api.renderers.BrowsableAPIRenderer',
|
||||
),
|
||||
'DEFAULT_METADATA_CLASS': 'awx.api.metadata.Metadata',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user