From 64d6ae64530765476c26b86c290b16e0175e0506 Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Wed, 25 Sep 2024 09:40:03 -0700 Subject: [PATCH] chore: treat file as binary, proper disable upload --- app/backend/lib/s3upload.ts | 4 +--- app/pages/analyst/gis/coverages.tsx | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/backend/lib/s3upload.ts b/app/backend/lib/s3upload.ts index a577f8cbe..a1b5df00b 100644 --- a/app/backend/lib/s3upload.ts +++ b/app/backend/lib/s3upload.ts @@ -29,7 +29,6 @@ s3upload.post('/api/s3/upload', limiter, async (req, res) => { return res.status(404).end(); } const form = formidable(commonFormidableConfig); - const files = await parseForm(form, req).catch((err) => { return res.status(400).json({ error: err }).end(); }); @@ -42,7 +41,7 @@ s3upload.post('/api/s3/upload', limiter, async (req, res) => { if (!uploaded) { return res.status(200).end(); } - const file = fs.readFileSync(uploaded.filepath, 'utf8'); + const file = fs.readFileSync(uploaded.filepath); const params = { Bucket: AWS_S3_BUCKET, @@ -51,7 +50,6 @@ s3upload.post('/api/s3/upload', limiter, async (req, res) => { }; const uploadResult = await uploadFileToS3(params); - if (uploadResult) { return res.json({ status: 'success' }); } diff --git a/app/pages/analyst/gis/coverages.tsx b/app/pages/analyst/gis/coverages.tsx index d5e97f426..cd0ddb73a 100644 --- a/app/pages/analyst/gis/coverages.tsx +++ b/app/pages/analyst/gis/coverages.tsx @@ -95,7 +95,6 @@ const CoveragesTab = () => { const [selectedFile, setSelectedFile] = useState(); const [isUploading, setIsUploading] = useState(false); const [uploadSuccess, setUploadSuccess] = useState(false); - const fileComponentValue = [ { id: '', @@ -183,7 +182,7 @@ const CoveragesTab = () => { {isUploading ? 'Uploading' : 'Upload'}