Skip to content

Commit

Permalink
fix(shell): use _ instead of - to sanitize environment variable n…
Browse files Browse the repository at this point in the history
…ame (#160)

Close #160
  • Loading branch information
Toilal committed Jan 14, 2021
1 parent 6f4f938 commit f9e11a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ddb/feature/shell/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(self):

@staticmethod
def _sanitize_key(key):
return slugify(key, regex_pattern=r'[^-a-zA-Z0-9_]+').upper()
return slugify(key, regex_pattern=r'[^-a-zA-Z0-9_]+', separator="_").upper()

def set_environment_variable(self, key, value):
yield "export " + self._sanitize_key(key) + "=" + shlex.quote(value)
Expand Down Expand Up @@ -194,7 +194,7 @@ def __init__(self):

@staticmethod
def _sanitize_key(key):
return slugify(key, regex_pattern=r'[^-a-zA-Z0-9_]+').upper()
return slugify(key, regex_pattern=r'[^-a-zA-Z0-9_]+', separator="_").upper()

def set_environment_variable(self, key, value):
# TODO: Maybe use subprocess.list2cmdline for Windows ?
Expand Down

0 comments on commit f9e11a8

Please sign in to comment.