Skip to content

Commit a68c2a6

Browse files
authored
[Fix-16786][Datasource] Fix jdbc connect parameters json validation question (#16787)
1 parent 53efdaa commit a68c2a6

File tree

1 file changed

+5
-11
lines changed
  • dolphinscheduler-ui/src/utils

1 file changed

+5
-11
lines changed

dolphinscheduler-ui/src/utils/json.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,11 @@
1919
* Verify if it is in json format
2020
*/
2121
const isJson = (str: string) => {
22-
if (typeof str === 'string') {
23-
try {
24-
const obj = JSON.parse(str)
25-
if (typeof obj === 'object' && obj) {
26-
return true
27-
} else {
28-
return false
29-
}
30-
} catch (e) {
31-
return false
32-
}
22+
try {
23+
const obj = JSON.parse(str)
24+
return !!(typeof obj === 'object' && obj && !Array.isArray(obj))
25+
} catch (e) {
26+
return false
3327
}
3428
}
3529

0 commit comments

Comments
 (0)