Feat/allow escaped equals #32
base: main
Are you sure you want to change the base?
Conversation
I've merged the main branch into this one, because contains the changes I had made for fixing the CI and it wasn't allowing the pipeline be green for integrating this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The principle of allowing escaped equals characters in the key seems safe to me after some consideration. however I don't think this patch is quite right yet. below is an example of the problem;
re:run("a\=\=b = b\=c",<<"(.*(\\\\=)?\\S)(\\s?=\\s?)(.*)">>, [{capture,[1,4],list}]).
{match,["a==b = b","c"]}
despite the clear intention of the input string, the regex has misinterpreted the division between key and value (correct answer should be "a==b" and "b=c" (assuming we decide not to unescape on the value side, which could be argued either way.
@@ -403,8 +403,9 @@ parse_ini_file(IniFile) -> | |||
";" ++ _Comment -> | |||
{AccSectionName, AccValues}; | |||
Line2 -> | |||
case re:split(Line2, "\s?=\s?", [{return, list}]) of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would re:split(Line2, "\s?(?<!\\\\)=\s?", [{return, list}])
work here? (that is, split the string only on =
when not immediately preceded by \
.
finally noting this is not a refactor as it changes the behaviour of the software. |
Note: config application was moved to the main repo. This PR can probably be closed or moved to the main repo |
Refactor of config file parser in order to allow equals characters on the keys escaping them with a backslash.
Needed for allowing declaring jwt:kid certificates whose kid contains equal signs.
Related with these two bugs:
apache/couchdb#3319
apache/couchdb#2188