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码字符进行编码。
pull/1594/head
GOGOsu 3 years ago committed by GitHub
parent 26230a3d3a
commit b9e72b9645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -93,8 +93,19 @@ class AliyunSMS extends NotificationProvider {
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("&"))}`;

Loading…
Cancel
Save