Skip to content

Instantly share code, notes, and snippets.

@ccsplit
Created May 15, 2017 17:41
Show Gist options
  • Save ccsplit/77b6491e151ca443630a24fd2ab85926 to your computer and use it in GitHub Desktop.
Save ccsplit/77b6491e151ca443630a24fd2ab85926 to your computer and use it in GitHub Desktop.
needle accent issue
diff --git i/needle/core/device/app.py w/needle/core/device/app.py
index 18c7e51..88f8c61 100644
--- i/needle/core/device/app.py
+++ w/needle/core/device/app.py
@@ -24,7 +24,7 @@ class App(object):
metadata_agent = self.__parse_from_agent()
# Content of the app's local Info.plist
- plist_info_path = Utils.escape_path('%s/Info.plist' % metadata_agent['binary_directory'])
+ plist_info_path = Utils.escape_path('%s/Info.plist' % metadata_agent['binary_directory'], escape_accent=True)^M
print(plist_info_path)
diff --git i/needle/core/utils/utils.py w/needle/core/utils/utils.py
index 573781a..df0f8d9 100644
--- i/needle/core/utils/utils.py
+++ w/needle/core/utils/utils.py
@@ -17,11 +17,16 @@ class Utils(object):
# PATH UTILS
# ==================================================================================================================
@staticmethod
- def escape_path(path):
+ def escape_path(path, escape_accent=False):^M
"""Escape the given path."""
import pipes
path = path.strip() # strip
path = path.strip(''''"''') # strip occasional single/double quotes from both sides
+ if escape_accent:^M
+ # Find the accents/backquotes that do not have a backslash^M
+ # in front of them and escape them.^M
+ path = re.sub('(?<!\\\\)`', '\`', path)^M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment