You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zi...@apache.org on 2024/11/08 02:51:27 UTC
(dolphinscheduler) branch dev updated: [Fix-16786][Datasource] Fix jdbc connect parameters json validation question (#16787)
This is an automated email from the ASF dual-hosted git repository.
zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new a68c2a6aa2 [Fix-16786][Datasource] Fix jdbc connect parameters json validation question (#16787)
a68c2a6aa2 is described below
commit a68c2a6aa244d196d171eddd7cb16aebc204e7f1
Author: 小可耐 <46...@users.noreply.github.com>
AuthorDate: Fri Nov 8 10:51:21 2024 +0800
[Fix-16786][Datasource] Fix jdbc connect parameters json validation question (#16787)
---
dolphinscheduler-ui/src/utils/json.ts | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/dolphinscheduler-ui/src/utils/json.ts b/dolphinscheduler-ui/src/utils/json.ts
index 3ce941ddb5..347486ad6e 100644
--- a/dolphinscheduler-ui/src/utils/json.ts
+++ b/dolphinscheduler-ui/src/utils/json.ts
@@ -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
}
}