fix(servertools): Fixed an issue with compression results handling in HandlerStatic where content was always being written even if not compressed.

This commit is contained in:
Philipp Kunz 2025-01-28 10:32:17 +01:00
parent 2ea4139974
commit e552a48c02
3 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 2025-01-28 - 3.0.54 - fix(servertools)
Fixed an issue with compression results handling in HandlerStatic where content was always being written even if not compressed.
- Corrected the double writing of response in HandlerStatic.
- Ensured that file buffers are only conditionally written based on compression availability.
## 2024-12-26 - 3.0.53 - fix(infohtml)
Remove Sentry script and logo from HTML template

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedserver',
version: '3.0.53',
version: '3.0.54',
description: 'A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.'
}

View File

@ -134,8 +134,10 @@ export class HandlerStatic extends Handler {
res.status(200);
if (compressionResult?.compressionMethod) {
res.header('Content-Encoding', compressionResult.compressionMethod);
res.write(compressionResult.result);
} else {
res.write(fileBuffer);
}
res.write(compressionResult.result);
res.end();
});
}