Skip to content

Commit

Permalink
[Fix-16786][Datasource] Fix jdbc connect parameters json validation q…
Browse files Browse the repository at this point in the history
…uestion (#16787)
  • Loading branch information
sdhzwc authored Nov 8, 2024
1 parent 53efdaa commit a68c2a6
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions dolphinscheduler-ui/src/utils/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@
* Verify if it is in json format
*/
const isJson = (str: string) => {
if (typeof str === 'string') {
try {
const obj = JSON.parse(str)
if (typeof obj === 'object' && obj) {
return true
} else {
return false
}
} catch (e) {
return false
}
try {
const obj = JSON.parse(str)
return !!(typeof obj === 'object' && obj && !Array.isArray(obj))
} catch (e) {
return false
}
}

Expand Down

0 comments on commit a68c2a6

Please sign in to comment.