mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 15:02:51 +03:00
Fix parsing of smartcardoptions config
With the previous code, a trailing newline would result in an empty space being part of the list. When this is passed to keytool, it fails with "Illegal option: ". Instead of doing overly complicated regex based string substitution followed by parametrized splitting, we can simply use `.split()` without any parameters, and Python will automatically strip any whitespace.
This commit is contained in:
parent
05e6c293c0
commit
a4d0698628
1 changed files with 2 additions and 1 deletions
|
@ -385,7 +385,8 @@ def read_config(opts=None):
|
||||||
# smartcardoptions must be a list since its command line args for Popen
|
# smartcardoptions must be a list since its command line args for Popen
|
||||||
smartcardoptions = config.get('smartcardoptions')
|
smartcardoptions = config.get('smartcardoptions')
|
||||||
if isinstance(smartcardoptions, str):
|
if isinstance(smartcardoptions, str):
|
||||||
config['smartcardoptions'] = re.sub(r'\s+', r' ', config['smartcardoptions']).split(' ')
|
options = re.sub(r'\s+', r' ', config['smartcardoptions']).split(' ')
|
||||||
|
config['smartcardoptions'] = [i.strip() for i in options if i]
|
||||||
elif not smartcardoptions and 'keystore' in config and config['keystore'] == 'NONE':
|
elif not smartcardoptions and 'keystore' in config and config['keystore'] == 'NONE':
|
||||||
# keystore='NONE' means use smartcard, these are required defaults
|
# keystore='NONE' means use smartcard, these are required defaults
|
||||||
config['smartcardoptions'] = ['-storetype', 'PKCS11', '-providerName',
|
config['smartcardoptions'] = ['-storetype', 'PKCS11', '-providerName',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue