fix: always send a response

This commit is contained in:
tdurieux
2023-05-08 14:14:19 +02:00
parent 6c4363182b
commit 4f6c1d25fc

View File

@@ -108,7 +108,6 @@ export default class S3Storage implements StorageBase {
Key: p,
});
const s = await this.client().send(command);
s.ContentLength;
res.status(200);
if (s.ContentType) {
res.contentType(s.ContentType);
@@ -116,7 +115,11 @@ export default class S3Storage implements StorageBase {
if (s.ContentLength) {
res.set("Content-Length", s.ContentLength.toString());
}
(s.Body as Readable)?.pipe(res);
if (s.Body) {
(s.Body as Readable)?.pipe(res);
} else {
res.end();
}
} catch (error) {
try {
res.status(500);