fix: expiration time (#1215)

This commit is contained in:
GatewayJ
2025-12-20 20:25:52 +08:00
committed by GitHub
parent b5535083de
commit cc31e88c91
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -20,7 +20,6 @@ use serde::{Deserialize, Serialize};
use serde_json::{Value, json}; use serde_json::{Value, json};
use std::collections::HashMap; use std::collections::HashMap;
use time::OffsetDateTime; use time::OffsetDateTime;
use time::macros::offset;
use tracing::warn; use tracing::warn;
const ACCESS_KEY_MIN_LEN: usize = 3; const ACCESS_KEY_MIN_LEN: usize = 3;
@@ -231,7 +230,7 @@ pub fn create_new_credentials_with_metadata(
let expiration = { let expiration = {
if let Some(v) = claims.get("exp") { if let Some(v) = claims.get("exp") {
if let Some(expiry) = v.as_i64() { if let Some(expiry) = v.as_i64() {
Some(OffsetDateTime::from_unix_timestamp(expiry)?.to_offset(offset!(+8))) Some(OffsetDateTime::from_unix_timestamp(expiry)?)
} else { } else {
None None
} }
+1 -1
View File
@@ -101,7 +101,7 @@ where
&& headers && headers
.get(header::CONTENT_TYPE) .get(header::CONTENT_TYPE)
.and_then(|v| v.to_str().ok()) .and_then(|v| v.to_str().ok())
.map(|ct| ct.split(';').next().unwrap_or("").trim()) .map(|ct| ct.split(';').next().unwrap_or("").trim().to_lowercase())
.map(|ct| ct == "application/x-www-form-urlencoded") .map(|ct| ct == "application/x-www-form-urlencoded")
.unwrap_or(false) .unwrap_or(false)
{ {