-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple issues with validateFileUpload function in src/patient/fileUpload.ts #7458
Comments
@vigneshhari @rithviknishad please check the issue and let me know if I can work on it |
I was thinking of using file signature checks via the file header to resolve the unsupported file type upload problem. |
@khavinshankar @sainak could you please check it once |
Hi, @coronasafe/care-frontend-maintainers, This issue has been automatically marked as stale because it has not had any recent activity. |
@nihal467 Can you verify if this is still an issue? |
@gigincg the issue still exists, added some comment related to the expected behavior as well |
@nihal467 @shivankacker Are these being solved in the File Upload Refactor? |
@shivankacker Are we using the accept prop for the input? Refer: https://stackoverflow.com/questions/4328947/limit-file-format-when-using-input-type-file |
Describe the bug
The validation function could be rewritten to ensure more reliability.
To Reproduce
Steps to reproduce the behavior:
a. Try to upload a file with some extension like .exe
b. Notice that the validateFileUpload function actually returns true in this case and later on while actually making the api call to /api/v1/files we get the error that the filetype is inaccurate, the expected behavior here should be to reject the file when it is getting uploaded in the first place instead of sending it over to the fileupload api to reduce unneccesary api calls.
Issue2-
a. Try changing the file extension of some .exe to .pdf
b. It will get uploaded normally, this should not be the case, the filetype only gets validated via the extension whereas a more reliable mechanism should be used to verify the filetype.
Issue3-
a. After uploading an unsupported file type and getting the error when we click on the cross button, the form fields get grayed out, it should get reset instead
Expected Behavior
make sure this same behavior is applicable in patient consultation page and patient files as well
steps to enter patient consultation file
steps to enter patient files
Screenshots
The text was updated successfully, but these errors were encountered: