Sanitise color control responses for shells that still dont use the kitty keyboard protocol
This commit is contained in:
parent
79a768ed55
commit
424fe9991b
1 changed files with 2 additions and 0 deletions
|
|
@ -551,6 +551,8 @@ def color_control(cp: ColorProfile, code: int, value: str | bytes | memoryview =
|
||||||
if isinstance(value, (bytes, memoryview)):
|
if isinstance(value, (bytes, memoryview)):
|
||||||
value = str(value, 'utf-8', 'replace')
|
value = str(value, 'utf-8', 'replace')
|
||||||
responses: dict[str, str] = {}
|
responses: dict[str, str] = {}
|
||||||
|
# Only printable ASCII payload allowed as it is echoed back
|
||||||
|
value = re.sub(r'[^ -~]', '', value)
|
||||||
for rec in value.split(';'):
|
for rec in value.split(';'):
|
||||||
key, sep, val = rec.partition('=')
|
key, sep, val = rec.partition('=')
|
||||||
if key.startswith('transparent_background_color'):
|
if key.startswith('transparent_background_color'):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue