This commit is contained in:
tamaina 2025-09-04 01:24:56 +09:00
parent dea632654a
commit 71613c0053
1 changed files with 6 additions and 5 deletions

View File

@ -242,7 +242,8 @@ export class FileServerService {
}
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream');
reply.header('Content-Length', getSizeFromIImage(image) ?? undefined);
const size = getSizeFromIImage(image);
if (size) reply.header('Content-Length', size);
reply.header('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition',
contentDisposition(
@ -337,11 +338,10 @@ export class FileServerService {
.resize({
height: 'emoji' in request.query ? 128 : 320,
withoutEnlargement: true,
})
.webp(webpDefault);
});
image = {
data,
data: await data.webp(webpDefault).toBuffer(),
ext: 'webp',
type: 'image/webp',
};
@ -403,7 +403,8 @@ export class FileServerService {
}
reply.header('Content-Type', image.type);
reply.header('Content-Length', getSizeFromIImage(image) ?? undefined);
const size = getSizeFromIImage(image);
if (size) reply.header('Content-Length', size);
reply.header('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition',
contentDisposition(