From b9e72b9645765b364f1b6d64d291ab1e979c3fcf Mon Sep 17 00:00:00 2001 From: GOGOsu Date: Sat, 30 Apr 2022 05:56:10 +0800 Subject: [PATCH] Update aliyun-sms.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aliyun-sms.js: escape more characters than encodeURIComponent see https://help.aliyun.com/document_detail/315526.html 字符A~Z、a~z、0~9以及字符-、_、.、~不编码。对其它ASCII码字符进行编码。 --- server/notification-providers/aliyun-sms.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/notification-providers/aliyun-sms.js b/server/notification-providers/aliyun-sms.js index fc2815112..325d2214b 100644 --- a/server/notification-providers/aliyun-sms.js +++ b/server/notification-providers/aliyun-sms.js @@ -92,9 +92,20 @@ class AliyunSMS extends NotificationProvider { let key = oa[i]; param2[key] = param[key]; } + + let moreEscapesTable = function(m) { + return { + "!": "%21", + "*": "%2A", + "'": "%27", + "(": "%28", + ")": "%29" + }[m] + }; for (let key in param2) { - data.push(`${encodeURIComponent(key)}=${encodeURIComponent(param2[key])}`); + let value = encodeURIComponent(param2[key]).replace(/[!*'()]/g, moreEscapesTable); + data.push(`${encodeURIComponent(key)}=${value}`); } let StringToSign = `POST&${encodeURIComponent("/")}&${encodeURIComponent(data.join("&"))}`;