From cc3d6a38ceeebe622bd2a5cabfe75ffd7ef20350 Mon Sep 17 00:00:00 2001 From: Xiaoguang Wang Date: Sat, 18 Sep 2021 16:56:37 +0800 Subject: [PATCH] open the DingTalk link in browser --- services/webhook/dingtalk.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/webhook/dingtalk.go b/services/webhook/dingtalk.go index 3296b1114a10f..7d352db18c69a 100644 --- a/services/webhook/dingtalk.go +++ b/services/webhook/dingtalk.go @@ -6,6 +6,7 @@ package webhook import ( "fmt" + "net/url" "strings" "code.gitea.io/gitea/models" @@ -175,7 +176,10 @@ func createDingtalkPayload(title, text, singleTitle, singleURL string) *Dingtalk Title: strings.TrimSpace(title), HideAvatar: "0", SingleTitle: singleTitle, - SingleURL: singleURL, + + // https://developers.dingtalk.com/document/app/message-link-description + // to open the link in browser, we should use this URL, otherwise the page is displayed inside DingTalk client, very difficult to visit non-public URLs. + SingleURL: "dingtalk://dingtalkclient/page/link?pc_slide=false&url=" + url.QueryEscape(singleURL), }, } }