Skip to content

Commit

Permalink
Replace line-feed with comma plus space in message
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Sep 28, 2024
1 parent 2a9664f commit 7daba26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qubesusbproxy/core3ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,11 @@ async def on_device_attach_usb(self, vm, event, device, options):
"qubes-usb-proxy not installed in the VM")
else:
# TODO: sanitize and include stdout
sanitized_stderr = e.stderr.replace(b"\n", b", ")
sanitized_stderr = ''.join(
[chr(c) for c in e.stderr if 0x20 <= c < 0x80])
[chr(c) for c in sanitized_stderr if 0x20 <= c < 0x80])
if sanitized_stderr.endswith(", "):
sanitized_stderr = santizied_stderr[:-2] + "."
raise QubesUSBException(
'Device attach failed: {}'.format(sanitized_stderr))
finally:
Expand Down

0 comments on commit 7daba26

Please sign in to comment.