Skip to content

Commit 492e1a2

Browse files
author
Thomas
committed
check false key and ignore the field
1 parent 27fa719 commit 492e1a2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/authentication/util/AdvancedMapUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class AdvancedMapUtils {
1313
*/
1414
public static String getString(Map<String, Object> map, String key) {
1515
if(key == null) return null;
16+
if(key.equals("false")) return null;
1617
String[] parts = key.split("\\.");
1718
Object current = map;
1819

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/authentication/AdvancedMapUtilsTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ public void testGetStringFromMap() throws Exception {
1717
Collections.singletonMap("def", Collections.singletonMap("hi", "hello world")),
1818
Collections.singletonMap("def", Collections.singletonMap("hi", "another value"))
1919
));
20+
nestedMap.put("false", "123");
2021

2122
String value0 = AdvancedMapUtils.getString(nestedMap, "abc[0].def.hi");
2223
String value1 = AdvancedMapUtils.getString(nestedMap, "abc[1].def.hi");
24+
String value2 = AdvancedMapUtils.getString(nestedMap, "false");
2325
Assertions.assertSame("hello world", value0);
2426
Assertions.assertSame("another value", value1);
27+
Assertions.assertSame(null, value2);
2528
}
2629
}

0 commit comments

Comments
 (0)