Skip to content

Commit c80d4cf

Browse files
author
李海清
committed
fix(FilesystemProxy): ensure cache TTL is always at least 1 second
1 parent 9cfac04 commit c80d4cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backend/cloudfile/src/Kernel/FilesystemProxy.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ public function getUploadTemporaryCredential(CredentialPolicy $credentialPolicy,
129129
'temporary_credential' => $temporaryCredential,
130130
'expires' => (int) $expires,
131131
];
132-
$this->setCache($cacheKey, $data, $expires - 60);
132+
$cacheTtl = max(0, (int) ($expires - time() - 60));
133+
$cacheTtl = max($cacheTtl, 1);
134+
$this->setCache($cacheKey, $data, $cacheTtl);
133135
return $data;
134136
}
135137

0 commit comments

Comments
 (0)