diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2024-12-07 13:40:32 +0000 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2024-12-07 13:40:32 +0000 |
| commit | f59af78d8aae17f7308a5345e39c730316c851ce (patch) | |
| tree | 1a2d2b00827f46bced1201a5967a37ca0f40630c /packages/backend/src | |
| parent | merge: Fix `MK_NO_DAEMONS` flag (!786) (diff) | |
| parent | Fix Content-Length resetting for partial content length requests (diff) | |
| download | sharkey-f59af78d8aae17f7308a5345e39c730316c851ce.tar.gz sharkey-f59af78d8aae17f7308a5345e39c730316c851ce.tar.bz2 sharkey-f59af78d8aae17f7308a5345e39c730316c851ce.zip | |
merge: Fix Content-Length resetting for partial content length requests (!796)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/796
Closes #824
Approved-by: Hazelnoot <acomputerdog@gmail.com>
Approved-by: Marie <github@yuugi.dev>
Diffstat (limited to 'packages/backend/src')
| -rw-r--r-- | packages/backend/src/server/FileServerService.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/backend/src/server/FileServerService.ts b/packages/backend/src/server/FileServerService.ts index a4d0588fbe..18d313db06 100644 --- a/packages/backend/src/server/FileServerService.ts +++ b/packages/backend/src/server/FileServerService.ts @@ -192,6 +192,9 @@ export class FileServerService { } } + // set Content-Length before we chunk, so it can properly override when chunking. + reply.header('Content-Length', file.file.size); + if (!image) { if (request.headers.range && file.file.size > 0) { const range = request.headers.range as string; @@ -235,7 +238,6 @@ export class FileServerService { } reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream'); - reply.header('Content-Length', file.file.size); reply.header('Cache-Control', 'max-age=31536000, immutable'); reply.header('Content-Disposition', contentDisposition( |