[gnome-keysign: 9/16] send: unquote attachment path



commit bb004e2eadc544e59b0945e0625c9aa401c310b6
Author: RyuzakiKK <aasonykk gmail com>
Date:   Mon Mar 25 13:05:33 2019 +0100

    send: unquote attachment path
    
    We need this because a few characters, for example '%', are encoded.

 keysign/send.py | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/keysign/send.py b/keysign/send.py
index dd1307e..1f83aa3 100644
--- a/keysign/send.py
+++ b/keysign/send.py
@@ -5,6 +5,11 @@ import mailbox
 import os
 import signal
 
+try:
+    from urllib.parse import unquote
+except ImportError:
+    from urllib import unquote
+
 import gi
 gi.require_version('Gtk', '3.0')
 from gi.repository import Gtk
@@ -117,6 +122,8 @@ class SendApp:
         # an attachment or an entire email.
         if not filename:
             filename = data.get_data().decode("utf-8")
+
+        filename = unquote(filename)
         filename = filename[7:].strip('\r\n\x00')  # remove file://, \r\n and NULL
         log.info("Received file: %s" % filename)
         signatures = get_attachments(filename)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]