Scope storage cache control to previews

This commit is contained in:
Chirag Aggarwal
2026-05-08 09:55:33 +05:30
parent 6abd88b8f1
commit 707e5d231a
+16 -13
View File
@@ -707,19 +707,22 @@ Http::init()
$cache->save($key, $data);
}
$cacheControl = $cacheControlForStorage(new CacheControl(
source: CacheControl::SOURCE_CACHE,
project: $project,
user: $user,
bucket: $bucket,
file: $file,
resourceToken: $resourceToken,
maxAge: $timestamp,
isImageTransformation: $isImageTransformation,
fileSecurity: $fileSecurity,
cacheLog: $cacheLog,
route: $route,
));
$cacheControl = \sprintf('private, max-age=%d', $timestamp);
if ($isImageTransformation) {
$cacheControl = $cacheControlForStorage(new CacheControl(
source: CacheControl::SOURCE_CACHE,
project: $project,
user: $user,
bucket: $bucket,
file: $file,
resourceToken: $resourceToken,
maxAge: $timestamp,
isImageTransformation: $isImageTransformation,
fileSecurity: $fileSecurity,
cacheLog: $cacheLog,
route: $route,
));
}
$response
->addHeader('Cache-Control', $cacheControl)