New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SHIRO-530] INI parser does not properly handled backslashes at end o… #209
Conversation
TODO:
test = "Truth\\=Beauty";
kv = Ini.Section.splitKeyValue(test);
assertEquals("Truth", kv[0]);
assertEquals("Beauty", kv[1]); |
We have some users that are using backslash in the key: |
?? Why introduce a new future? If you look at the tests, this was never supported and those always got removed. |
From SHIRO-530, it looks like we have:
I would expect the result to be:
As for [foobar]
one=one
justAKeyWithoutValue I'm not saying this is the way it does function, or should just what I personally would expect. (not sure if that helps or hurts this conversation) |
…f values - Replace key-value-splitting with regex - obscure disappearing escaping chars - please discuss! - remove escaping backslashes from the first capture group (key) to retain old behaviour. - Do not remove escaping baskslashes from the value (new behaviour demanded by SHIRO-530). - rearrange and comment tests to reflect old and new, desired behaviour. Signed-off-by: Benjamin Marwell <bmarwell@gmail.com>
Thanks for the input @bdemers, I had the very same thoughts! The new force-pushed commit:
Actually, what @fpapon pointed out by posting the link: The XML config DOES allow backslashes in the key, where the Ini never allowed to do so. Please review my new commit which reflects these changes. I moved the tests a bit and commented them, so we can see what would change. |
+1 for me, if we think it's not possible (ini specs) to have \ in the key, just throw an exception. |
…f values - Replace key-value-splitting with regex - remove escaping backslashes from the first capture group (key) to retain old behaviour. - Do not remove escaping baskslashes from the value (new behaviour demanded by SHIRO-530). - rearrange and comment tests to reflect old and new, desired behaviour. - seperator char can be preceeded or followed by whitespace. Signed-off-by: Benjamin Marwell <bmarwell@gmail.com>
I am not so sure about this commit. It would be possible, in theory, that someone misused the escaping backslashes (which disappeared from the value) as indendation: key = value\
\\1 In the old word, this was But then, it was never documented. |
Superseeded by #210 |
…f values
Signed-off-by: Benjamin Marwell bmarwell@gmail.com
Now. If we would not want to break the existing (imho: obscure) way that shiro parses the
shiro.ini
file, we could introduce a parser strategy pattern.But as the existing behaviour was not documented (other than tests), I would like to see a discussion about this.
Tests broken on purpose! See here why: SHIRO-530