cllipy fix

This commit is contained in:
Donjuanplatinum
2026-03-08 12:23:02 +08:00
parent 2b81e189cb
commit ad896bb091
4 changed files with 52 additions and 42 deletions

View File

@@ -100,17 +100,21 @@ pub(crate) async fn create_mxc_uri_route(
media_id: &utils::random_string(MXC_LENGTH),
};
let unused_expires_at = (std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("Time went backwards")
.as_millis() as u64)
.saturating_add(
services
let unused_expires_at = u64::try_from(
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("Time went backwards")
.as_millis(),
)?
.saturating_add(
services
.server
.config
.media_create_unused_expiration_time
* 1000,
);
.media_create_unused_expiration_time
// safe because even if it overflows, it will be greater than the current time
// and the unused media will be deleted anyway
.saturating_mul(1000),
);
services
.media
.create_pending(&mxc, user, unused_expires_at)