diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-09 03:48:54 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-09 05:01:50 +0100 |
commit | 83c14ba264a27c09b14b4a4ea77a2bd95de7b794 (patch) | |
tree | fb9a08cf6dc87a3af67a7a48c3a620fbbc17a517 | |
parent | 64143a5957f0ed662beca839bcf570c374c98eb4 (diff) | |
download | xK-83c14ba264a27c09b14b4a4ea77a2bd95de7b794.tar.gz xK-83c14ba264a27c09b14b4a4ea77a2bd95de7b794.tar.xz xK-83c14ba264a27c09b14b4a4ea77a2bd95de7b794.zip |
degesch: Lua: fix plugin configuration names
-rw-r--r-- | degesch.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -7276,7 +7276,16 @@ plugin_config_name (struct plugin *self) begin = p; size_t len = strcspn (begin, "."); - return len ? xstrndup (begin, len) : NULL; + if (!len) + return NULL; + + // XXX: we might also allow arbitrary strings as object keys (except dots) + // taking care to use the "" syntax while serializing + char *copy = xstrndup (begin, len); + for (char *p = copy; *p; p++) + if (!config_tokenizer_is_word_char (*p)) + *p = '_'; + return copy; } // --- Lua --------------------------------------------------------------------- |