MLH-Fellowship / CryptoDrive

A Decentralised Encrypted File Storing and Sharing App which is back-boned by Ethereum Smart Contracts and is preparing its launch to the moon 🚀
https://www.cryptodrive.tech/
MIT License
28 stars 13 forks source link

[Edge Case] Handle the Empty file Upload #104

Open ksdkamesh99 opened 3 years ago

ksdkamesh99 commented 3 years ago

If the user uploads an empty file then it should stop the upload and send an alert to the user stating that the uploaded file is empty.

elleanne commented 3 years ago

I would like to work on this issue! It looks like what you're talking about is line 52 in Dashboard/dashboard.jsx, const captureFile = (files, event) => ? Or is it line 74, const onSubmit = async (event) => { ?

Sameerkash commented 3 years ago

@eliboss, sure please go ahead, I think this could be accomplished while the file is captured, you can read the contents of the file, similar code is available here https://github.com/MLH-Fellowship/CryptoDrive/blob/3818aa78a0d68503b81f016c2dec63f3c38a5e9d/src/pages/Login/index.jsx#L44

so you could similarly read the file, or compare its size and ensure it's not 0 bytes. and then send an alert and return.

elleanne commented 3 years ago

Awesome, I'll work on it today!

elleanne commented 3 years ago

I tried signing up both locally and on your deployed site so I could test this issue. The same issue occurred on both host sites, shown below.

Does this have to do with adding a local host network to MetaMask?

Locally

Screen Shot 2021-04-15 at 3 09 53 PM

Deployed

Screen Shot 2021-04-15 at 3 09 46 PM
elleanne commented 3 years ago

Update: I was able to upload a .pem file on the signin page without having an account (Though, of course, couldn't cont. past that page) The alert worked when the .pem file had no text in it

ksdkamesh99 commented 3 years ago

@eliboss Thanks for solving the issue. If you want to upload any file then metamask is needed in each timestep. The issue is not for only pem file it's about the files in drag and drop as well

elleanne commented 3 years ago

ah, ok. It sent me an alert that only .pem files could be uploaded on the signin page. If I need to check the drop in drag, Ill need a login. But I was having issues with that (see above comment). If you can get me connected to that, Ill look at it tomorrow.

Sameerkash commented 3 years ago

ah, ok. It sent me an alert that only .pem files could be uploaded on the sign-in page. If I need to check the drop-in drag, I'll need a login. But I was having issues with that (see above comment). If you can get me connected to that, I'll look at it tomorrow.

@eliboss mostly looks like a meta mask error, do you have MetaMask extension installed?

ksdkamesh99 commented 3 years ago

ok @eliboss As this is an edge case and it needs to be fixed asap there are 2 options with us. One to make you understand the metamask one or the maintainer team need to solve it asap. Kindly respond in our discord channel.

ksdkamesh99 commented 3 years ago

@eliboss One more thing is you should not make any PR to main. Any PR should be made to staging as per the guidelines.

elleanne commented 3 years ago

@ksdkamesh99 I dont see your discord link anywhere. Can you send it to me?

Priyanshu-official commented 3 years ago

@eliboss https://discord.com/invite/BKgbJFS4Kf