Skip to content

Commit

Permalink
fix: config-tool cannot be opened when the Control Center dbus API ca…
Browse files Browse the repository at this point in the history
…ll fails

Modify the parameters of the jq command to
handle invalid JSON format inputs.

Fixes linuxdeepin/developer-center#3659
  • Loading branch information
zsien committed Mar 15, 2023
1 parent 3f65377 commit 23a1723
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Depends:
libfcitx5config6 (= ${binary:Version}),
libfcitx5core7 (= ${binary:Version}),
libfcitx5utils2 (= ${binary:Version}),
jq,
${misc:Depends},
${shlibs:Depends},
Recommends:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ index 4daf97a..6251da9 100755
+ local dbus_interface="org.deepin.dde.ControlCenter1"
+ local dcc_module="keyboard/Manage Input Methods"
+
+ if dbus-send --print-reply=literal --dest=$dbus_service $dbus_path $dbus_interface.GetAllModule | jq -e ".[] | select(.url == \"${dcc_module}\")" >> /dev/null 2>&1; then
+ if dbus-send --print-reply=literal --dest=$dbus_service $dbus_path $dbus_interface.GetAllModule 2>> /dev/null | jq --arg url "$dcc_module" -Rse 'fromjson? // error("Bad input") | any(.url == $url)' >> /dev/null 2>&1; then
+ exec dbus-send --print-reply=literal --dest=$dbus_service $dbus_path $dbus_interface.ShowPage string:"$dcc_module"
+ fi
+ return 1
Expand Down

0 comments on commit 23a1723

Please sign in to comment.