mirror of
https://github.com/evilhero/mylar
synced 2024-12-23 16:22:45 +00:00
FIX:(#1785) Fix for passwords containing a % character causing interpolation problems due to the config parser
This commit is contained in:
parent
6754ad0b8b
commit
ab0d195196
1 changed files with 12 additions and 2 deletions
|
@ -400,11 +400,17 @@ class Config(object):
|
|||
|
||||
setattr(self, k, value)
|
||||
|
||||
try:
|
||||
#make sure interpolation isn't being used, so we can just escape the % character
|
||||
if v[0] == str:
|
||||
value = value.replace('%', '%%')
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
#just to ensure defaults are properly set...
|
||||
if any([value is None, value == 'None']):
|
||||
value = v[0](v[2])
|
||||
|
||||
|
||||
if all([self.MINIMAL_INI is True, str(value) != str(v[2])]) or self.MINIMAL_INI is False:
|
||||
try:
|
||||
config.add_section(v[1])
|
||||
|
@ -580,8 +586,12 @@ class Config(object):
|
|||
if any([value is None, value == ""]):
|
||||
value = definition_type(default)
|
||||
if config.has_section(section) and (all([self.MINIMAL_INI is True, definition_type(value) != definition_type(default)]) or self.MINIMAL_INI is False):
|
||||
try:
|
||||
if definition_type == str:
|
||||
value = value.replace('%', '%%')
|
||||
except Exception as e:
|
||||
pass
|
||||
config.set(section, ini_key, str(value))
|
||||
|
||||
else:
|
||||
config.set(section, ini_key, str(self.MINIMAL_INI))
|
||||
|
||||
|
|
Loading…
Reference in a new issue