summarylogtreecommitdiffstats
path: root/001_fix_shell_escape.patch
blob: 961d72ed4c6694ffb7d51e838aa5f4fa4643e6d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- a/urwid_ui.py
+++ b/urwid_ui.py
@@ -5,6 +5,7 @@ Implemented using the console user interface library urwid.
 """
 import subprocess
 import shlex
+import pipes
 import logging
 logger = logging.getLogger(__name__)
 
@@ -322,16 +323,16 @@ class MainFrame(urwid.Frame):
 
         elif key in ["enter"]:
             if self.selected_note:
-                system(self.editor + " '" + self.selected_note.abspath + "'", self.loop)
+                system(self.editor + ' ' + pipes.quote(self.selected_note.abspath), self.loop)
             else:
                 if self.search_box.edit_text:
                     try:
                         note = self.notebook.add_new(self.search_box.edit_text)
-                        system(self.editor + " '" + note.abspath + "'", self.loop)
+                        system(self.editor + ' ' + pipes.quote(note.abspath), self.loop)
                     except notebook.NoteAlreadyExistsError:
                         # Try to open the existing note instead.
-                        system(self.editor + " '" + self.search_box.edit_text +
-                                self.notebook.extension + "'",
+                        system(self.editor + ' ' + pipes.quote(self.search_box.edit_text +
+                                self.notebook.extension),
                             self.loop)
                     except notebook.InvalidNoteTitleError:
                         # TODO: Display error message to user.