We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
发送企业微信消息时对url的处理不够优雅,尤其是对提交人主动终止工单处理有误
提交人主动终止工单
补丁 sendmsg.py.20211124.patch
diff --git a/common/utils/sendmsg.py b/common/utils/sendmsg.py index 8add6b7..7aace1d 100755 --- a/common/utils/sendmsg.py +++ b/common/utils/sendmsg.py @@ -1,5 +1,6 @@ # -*- coding: UTF-8 -*- +import re import email import smtplib import requests @@ -191,10 +192,19 @@ class MsgSender(object): def send_qywx_webhook(self,qywx_webhook, msg): send_url = qywx_webhook + + # 对链接进行转换 + _msg = re.findall('https://.+(?=\n)|http://.+(?=\n)', msg) + for url in _msg: + # 防止如 [xxx](http://www.baidu.com)\n 的字符串被再次替换 + if url.strip()[-1] != ")": + msg=msg.replace(url,'[请点击链接](%s)' % url) + data = { "msgtype": "markdown", "markdown": { - "content": msg.replace('工单地址:', '工单地址:[请点击链接](').replace('\n工单详情预览:', ')\n工单详情预览:') + # "content": msg.replace('工单地址:', '工单地址:[请点击链接](').replace('\n工单详情预览:', ')\n工单详情预览:') + "content": msg }, } res = requests.post(url=send_url, json=data, timeout=5)
应用补丁 patch -p1 < sendmsg.py.20211124.patch
The text was updated successfully, but these errors were encountered:
你好, 请直接提交pr
Sorry, something went wrong.
发送企业微信消息带有url的优化 (hhyo#1244)
70ad221
eb326a5
Merge pull request #1247 from weideguo/master
e776988
发送企业微信消息带有url的优化 (#1244)
No branches or pull requests
目前遇到的问题/使用障碍
发送企业微信消息时对url的处理不够优雅,尤其是对
提交人主动终止工单
处理有误希望如何解决/实现它
补丁 sendmsg.py.20211124.patch
应用补丁
patch -p1 < sendmsg.py.20211124.patch
The text was updated successfully, but these errors were encountered: