Update aliyun-sms.js

aliyun-sms.js: escape more characters than encodeURIComponent
see https://help.aliyun.com/document_detail/315526.html
字符A~Z、a~z、0~9以及字符-、_、.、~不编码。对其它ASCII码字符进行编码。
This commit is contained in:
GOGOsu 2022-04-30 05:56:10 +08:00 committed by GitHub
parent 26230a3d3a
commit b9e72b9645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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("&"))}`;