mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-12-02 12:01:17 +00:00
fix #607 decode data before sending it to pyperclip
This commit is contained in:
parent
783e904b92
commit
17b34de28d
@ -284,8 +284,15 @@ 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
|
||||||
|
|
||||||
|
# this is because pyperclip does an encode('utf-8') without checking if data is already encoded or not
|
||||||
|
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