MSFREACH / msf-reach

Web platform for MSF-REACH
https://msf-reach.org/
4 stars 5 forks source link

uploads not working #690

Closed qclin closed 5 years ago

qclin commented 5 years ago

Download URL request generated in the backend https://github.com/MSFREACH/msf-reach/blob/ux/navigation/src/api/routes/utils/index.js#L60

Download Okay but rendering in the browser doesn't work https://github.com/MSFREACH/msf-reach/blob/ux/navigation/app/src/components/CountryDetails.vue#L73

To test Login to UX site as matthewberryman Under Event Detail > Country Details (expand on of the sections) > Upload file

screen shot 2019-02-15 at 3 22 21 am

https://ux.msf-reach.org/#/events/257/country-details

matthewberryman commented 5 years ago

At first glance at the code it seems it's as I thought in that the template gets rendered first (when downloadUrl isn't set), but @mehrdadgit knows his way around vue.js much better than me.

mehrdadgit commented 5 years ago

Had a look; my best guess is that the signed download is fine but signed upload is not working properly; To verify can somebody check the S3 bucket manually to see if e.g. this file is properly uploaded: msf-reach-file-uploads.s3.ap-southeast-1.amazonaws.com/countryDetails/PH/mission/f417d053-2876-4663-b03c-9ebb6b436e72_logo.png (making sure you can see the photo when you download it manually from S3 as the signed donwload link returns a 13-byte corrupted empty file...

if so, the problem could be somewhere around here which would need a deeper look: https://github.com/MSFREACH/msf-reach/blob/ux/navigation/app/src/components/CountryDetails.vue#L216

EDIT: see below the content of logo.png I uploaded, the downloaded and changed the extension to .txt , looks like a JS object : image

matthewberryman commented 5 years ago

@qclin, @mehrdadgit is correct, the upload process is broken—you're sending [object File] not the file itself. Additionally you probably want to wait for all files to finish uploading before calling save() rather than calling it for each one.

qclin commented 5 years ago

@matthewberryman @mehrdadgit thanks i reverted back to ajax for uploading, axios seem to send double request with [object: file]

it works now, but for file names with spaces, s3 is still returning Access denied, will close this once that's resolved

qclin commented 5 years ago

resolve in 90aad8a2502de1cb6279817c27b4070ed18040da