mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-30 03:00:40 +00:00
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:
parent
26230a3d3a
commit
b9e72b9645
1 changed files with 12 additions and 1 deletions
|
@ -92,9 +92,20 @@ class AliyunSMS extends NotificationProvider {
|
||||||
let key = oa[i];
|
let key = oa[i];
|
||||||
param2[key] = param[key];
|
param2[key] = param[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let moreEscapesTable = function(m) {
|
||||||
|
return {
|
||||||
|
"!": "%21",
|
||||||
|
"*": "%2A",
|
||||||
|
"'": "%27",
|
||||||
|
"(": "%28",
|
||||||
|
")": "%29"
|
||||||
|
}[m]
|
||||||
|
};
|
||||||
|
|
||||||
for (let key in param2) {
|
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("&"))}`;
|
let StringToSign = `POST&${encodeURIComponent("/")}&${encodeURIComponent(data.join("&"))}`;
|
||||||
|
|
Loading…
Reference in a new issue