diff options
-rw-r--r-- | ranger/ext/shell_escape.py | 4 | ||||
-rw-r--r-- | ranger/fsobject/fsobject.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/console.py | 8 | ||||
-rw-r--r-- | ranger/runner.py | 1 |
4 files changed, 8 insertions, 9 deletions
diff --git a/ranger/ext/shell_escape.py b/ranger/ext/shell_escape.py index 682cd86f..01304033 100644 --- a/ranger/ext/shell_escape.py +++ b/ranger/ext/shell_escape.py @@ -20,12 +20,12 @@ META_CHARS = (' ', "'", '"', '`', '&', '|', ';', '$', '!', '(', ')', '[', ']', '<', '>') META_DICT = dict([(mc, '\\' + mc) for mc in META_CHARS]) -def shell_escape(string): +def shell_quote(string): """Escapes by quoting""" return "'" + str(string).replace("'", "'\\''") + "'" -def shell_escape2(arg): +def shell_escape(arg): """Escapes by adding backslashes""" arg = str(arg) arg = arg.replace('\\', '\\\\') # make sure this comes at the start diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py index 4b734e8a..76e9bd3c 100644 --- a/ranger/fsobject/fsobject.py +++ b/ranger/fsobject/fsobject.py @@ -18,7 +18,7 @@ DOCUMENT_BASENAMES = 'README TODO LICENSE COPYING INSTALL'.split() from . import T_FILE, T_DIRECTORY, T_UNKNOWN, T_NONEXISTANT, BAD_INFO from ranger.shared import MimeTypeAware, FileManagerAware -from ranger.ext.shell_escape import shell_escape2 +from ranger.ext.shell_escape import shell_escape class FileSystemObject(MimeTypeAware, FileManagerAware): is_file = False @@ -82,7 +82,7 @@ class FileSystemObject(MimeTypeAware, FileManagerAware): @property def shell_escaped_basename(self): if self._shell_escaped_basename is None: - self._shell_escaped_basename = shell_escape2(self.basename) + self._shell_escaped_basename = shell_escape(self.basename) return self._shell_escaped_basename def get_description(self): diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 34c8abf5..a5fd30a2 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -25,7 +25,7 @@ from . import Widget from ranger import commands from ranger.gui.widgets.console_mode import is_valid_mode, mode_to_class from ranger import log -from ranger.ext.shell_escape import shell_escape +from ranger.ext.shell_escape import shell_quote DEFAULT_HISTORY = 0 SEARCH_HISTORY = 1 @@ -421,11 +421,11 @@ class OpenConsole(ConsoleWithTab): dct = {} if self.fm.env.cf: - dct['f'] = shell_escape(self.fm.env.cf.basename) + dct['f'] = shell_quote(self.fm.env.cf.basename) else: dct['f'] = '' - dct['s'] = ' '.join(shell_escape(fl.basename) \ + dct['s'] = ' '.join(shell_quote(fl.basename) \ for fl in self.fm.env.get_selection()) return _CustomTemplate(command).safe_substitute(dct) @@ -445,7 +445,7 @@ class OpenConsole(ConsoleWithTab): add_selection = True if add_selection: - cmd += ' ' + ' '.join(shell_escape(fl.basename) \ + cmd += ' ' + ' '.join(shell_quote(fl.basename) \ for fl in self.env.get_selection()) return (cmd, flags) diff --git a/ranger/runner.py b/ranger/runner.py index c61c11a5..25c0fb3b 100644 --- a/ranger/runner.py +++ b/ranger/runner.py @@ -33,7 +33,6 @@ p: redirect output to the pager import os import sys from subprocess import Popen, PIPE -from ranger.ext.shell_escape import shell_escape from ranger.ext.waitpid_no_intr import waitpid_no_intr |