mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 10:26:23 +00:00
commit
bf7b76a997
@ -284,8 +284,16 @@ def copy_flow(part, scope, flow, master, state):
|
|||||||
signals.status_message.send(message="No contents to copy.")
|
signals.status_message.send(message="No contents to copy.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# pyperclip calls encode('utf-8') on data to be copied without checking.
|
||||||
|
# if data are already encoded that way UnicodeDecodeError is thrown.
|
||||||
|
toclip = ""
|
||||||
try:
|
try:
|
||||||
pyperclip.copy(data)
|
toclip = data.decode('utf-8')
|
||||||
|
except (UnicodeDecodeError):
|
||||||
|
toclip = data
|
||||||
|
|
||||||
|
try:
|
||||||
|
pyperclip.copy(toclip)
|
||||||
except (RuntimeError, UnicodeDecodeError, AttributeError):
|
except (RuntimeError, UnicodeDecodeError, AttributeError):
|
||||||
def save(k):
|
def save(k):
|
||||||
if k == "y":
|
if k == "y":
|
||||||
|
Loading…
Reference in New Issue
Block a user