Skip to content

Commit

Permalink
Fix headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Mar 25, 2024
1 parent 3f8eb74 commit 430072c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/lib/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export default class S3Helper {
}

async stream(res, name) {
let s3headers;
try {
const s3headers = await s3.send(new S3.HeadObjectCommand(this.params));
s3headers = await s3.send(new S3.HeadObjectCommand(this.params));
} catch (err) {
if (err.Code === 'NoSuchKey') throw new Err(404, null, 'No File Found');
throw new Err(500, err, 'Internal Error');
Expand All @@ -26,7 +27,7 @@ export default class S3Helper {
res.writeHead(200, {
'Content-Disposition': `inline; filename="${name}"`,
'Content-Length': s3headers.ContentLength,
'ContentType': s3headers.ContentType,
'ContentType': s3headers.ContentType
});

s3request.Body.pipe(res);
Expand Down

0 comments on commit 430072c

Please sign in to comment.