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-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('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition', reply.header('Content-Disposition',
contentDisposition( contentDisposition(
@ -337,11 +338,10 @@ export class FileServerService {
.resize({ .resize({
height: 'emoji' in request.query ? 128 : 320, height: 'emoji' in request.query ? 128 : 320,
withoutEnlargement: true, withoutEnlargement: true,
}) });
.webp(webpDefault);
image = { image = {
data, data: await data.webp(webpDefault).toBuffer(),
ext: 'webp', ext: 'webp',
type: 'image/webp', type: 'image/webp',
}; };
@ -403,7 +403,8 @@ export class FileServerService {
} }
reply.header('Content-Type', image.type); 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('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition', reply.header('Content-Disposition',
contentDisposition( contentDisposition(