Skip to content

Commit

Permalink
Don't set body for 0-length files
Browse files Browse the repository at this point in the history
  • Loading branch information
kotx committed Jun 8, 2022
1 parent 3f14d87 commit bb39427
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default {
return new Response("File Not Found", { status: 404 });
}

response = new Response(hasBody(file) ? file.body : null, {
response = new Response((hasBody(file) && file.size !== 0) ? file.body : null, {
status: (file?.size || 0) === 0 ? 204 : (range ? 206 : 200),
headers: {
"accept-ranges": "bytes",
Expand Down

0 comments on commit bb39427

Please sign in to comment.