This commit is contained in:
2020-01-23 18:40:49 +08:00
parent 33a4ea74af
commit e2075110f2
3 changed files with 6 additions and 5 deletions

View File

@@ -383,16 +383,16 @@ impl <'a> DingTalk<'a> {
// Just Ok
} else if self.default_webhook_url.contains('?') {
if !self.default_webhook_url.ends_with('&') {
signed_url.push_str("&");
signed_url.push('&');
}
} else {
signed_url.push_str("?");
signed_url.push('?');
}
signed_url.push_str("access_token=");
signed_url.push_str(&urlencoding::encode(self.access_token));
if self.sec_token != "" {
if !self.sec_token.is_empty() {
let timestamp = &format!("{}", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis());
let timestamp_and_secret = &format!("{}\n{}", timestamp, self.sec_token);
let hmac_sha256 = base64::encode(&calc_hmac_sha256(self.sec_token.as_bytes(), timestamp_and_secret.as_bytes())?[..]);