Skip to content

Commit 974c31d

Browse files
committed
No longer create empty list items for possible locations of the CA file
Signed-off-by: Keith Bowes <[email protected]>
1 parent 70f760d commit 974c31d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

offlineimap/utils/distro_utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,24 @@ def get_os_sslcertfile_searchpath():
7272
at all.
7373
"""
7474
os_name = get_os_name()
75-
location = __DEF_OS_LOCATIONS.get(os_name, [''])
75+
location = __DEF_OS_LOCATIONS.get(os_name, [])
7676

7777
try:
7878
import ssl
7979
verify_paths = ssl.get_default_verify_paths()
80-
location += [os.getenv(verify_paths.openssl_cafile_env) or '']
81-
location += [verify_paths.cafile or '']
80+
cafile_by_envvar = os.getenv(verify_paths.openssl_cafile_env)
81+
if cafile_by_envvar is not None:
82+
location += [cafile_by_envvar]
83+
cafile_resolved = verify_paths.cafile
84+
if cafile_resolved is not None:
85+
location += [cafile_resolved]
86+
cafile_hardcoded = verify_paths.openssl_cafile
87+
if cafile_hardcoded is not None:
88+
location += [cafile_hardcoded]
8289
except AttributeError:
8390
pass
8491
finally:
85-
if location.count('') == len(location):
92+
if len(location) == 0:
8693
return None
8794

8895
return location

0 commit comments

Comments
 (0)