fix: send file type based on its extension

This commit is contained in:
tdurieux
2023-01-16 15:03:49 +01:00
parent 2c2a3714c5
commit 3091b13776
+3
View File
@@ -202,6 +202,9 @@ export default class AnonymizedFile {
async send(res: Response): Promise<void> { async send(res: Response): Promise<void> {
const pipe = promisify(pipeline); const pipe = promisify(pipeline);
try { try {
if (await this.extension()) {
res.contentType(await this.extension());
}
await pipe(await this.anonymizedContent(), res); await pipe(await this.anonymizedContent(), res);
} catch (error) { } catch (error) {
handleError(error, res); handleError(error, res);