diff --git a/changelog.md b/changelog.md index 0d35a48..4c23f8c 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 8d81807..9e0c685 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -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.' } diff --git a/ts/servertools/classes.handlerstatic.ts b/ts/servertools/classes.handlerstatic.ts index 4757d87..78eea52 100644 --- a/ts/servertools/classes.handlerstatic.ts +++ b/ts/servertools/classes.handlerstatic.ts @@ -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(); }); }