forked from TrueCloudLab/frostfs-node
[#493] node/config: Fix corrupting of path to the subsection
In previous implementation `Config.Sub` method could lead to the violation of the internal `path` slice because of `append`. This has been observed on deeply nested subsections. Fix `Config.Sub` to copy internal slice in order to prevent violations. Cover problem case in test config files and unit test. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
72d81dba92
commit
e26dc0a6e3
4 changed files with 46 additions and 2 deletions
|
@ -1,7 +1,18 @@
|
|||
{
|
||||
"value": "some value",
|
||||
|
||||
"section": {
|
||||
"any": "thing"
|
||||
"any": "thing",
|
||||
"sub": {
|
||||
"sub": {
|
||||
"sub1": {
|
||||
"key": "val1"
|
||||
},
|
||||
"sub2": {
|
||||
"key": "val2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"string_slice": {
|
||||
|
|
|
@ -3,6 +3,14 @@ value: some value
|
|||
section:
|
||||
any: thing
|
||||
|
||||
sub:
|
||||
sub:
|
||||
sub1:
|
||||
key: val1
|
||||
|
||||
sub2:
|
||||
key: val2
|
||||
|
||||
string_slice:
|
||||
empty: []
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue