[projects/pld-ftp-admin] config: keep values with = and treat empty ones as unset
arekm
arekm at pld-linux.org
Sat Oct 24 11:46:19 CEST 2026
commit ec958aca3f6da48b40006af6825046b88594411b
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Tue Oct 20 16:38:11 2026 +0200
config: keep values with = and treat empty ones as unset
An empty value stopped every tool and ftpiod from starting.
modules/config.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/modules/config.py b/modules/config.py
index e7e5f25..851e400 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -14,11 +14,17 @@ f = open(path + '/.ftpadmrc', 'r')
for line in f.readlines():
if line[0] == '#' or str.find(line, '=') == -1:
continue
- tuple = str.split(str.strip(line), '=')
- if tuple[1][0] == '"':
- value[str.strip(tuple[0])] = tuple[1][1:-1]
+ tuple = str.split(str.strip(line), '=', 1)
+ key = str.strip(tuple[0])
+ if tuple[1][:1] == '"':
+ val = tuple[1][1:-1]
else:
- value[str.strip(tuple[0])] = str.strip(tuple[1])
+ val = str.strip(tuple[1])
+ # an empty value means unset, so optional keys fall back and required ones fail
+ if val:
+ value[key] = val
+ else:
+ value.pop(key, None)
f.close()
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/e14cb7d4d74f8bdd9368d9645ecaf49593cf6335
More information about the pld-cvs-commit
mailing list