From d5a9bd70e2fbfd35742c0526f6ec48e73ba7e4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Tue, 14 Nov 2023 10:48:40 +0000 Subject: [PATCH] fix: tsc compilation issues --- api.planx.uk/modules/file/controller.ts | 3 +-- api.planx.uk/modules/file/service/getFile.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/api.planx.uk/modules/file/controller.ts b/api.planx.uk/modules/file/controller.ts index 0e718e133e..206750bb19 100644 --- a/api.planx.uk/modules/file/controller.ts +++ b/api.planx.uk/modules/file/controller.ts @@ -5,7 +5,6 @@ import { getFileFromS3 } from "./service/getFile"; import { z } from "zod"; import { ValidatedRequestHandler } from "../../shared/middleware/validate"; import { ServerError } from "../../errors"; -import { S3 } from "aws-sdk"; assert(process.env.AWS_S3_BUCKET); assert(process.env.AWS_S3_REGION); @@ -73,7 +72,7 @@ export const downloadFileSchema = z.object({ export type DownloadController = ValidatedRequestHandler< typeof downloadFileSchema, - S3.Body | undefined + Buffer | undefined >; export const publicDownloadController: DownloadController = async ( diff --git a/api.planx.uk/modules/file/service/getFile.ts b/api.planx.uk/modules/file/service/getFile.ts index b9761cd8d1..29b3c539cd 100644 --- a/api.planx.uk/modules/file/service/getFile.ts +++ b/api.planx.uk/modules/file/service/getFile.ts @@ -11,7 +11,7 @@ export const getFileFromS3 = async (fileId: string) => { const file = await s3.getObject(params).promise(); return { - body: file.Body, + body: file.Body as Buffer, isPrivate: file.Metadata?.is_private === "true", headers: { "Content-Type": file.ContentType,