-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Bug Description
If a user accidentally uploads a directory that does not contain any valid .dcm or .img files (which is common in messy datasets), the frontend bypasses validation. It sets the loading state to true and fires an empty POST request to the FastAPI backend. This causes an unhandled 500 Internal Server Error, and the user receives a generic, unhelpful AxiosError toast instead of actionable feedback.
Steps to Reproduce
- Go to the OSIPI ASL Reporting Tool frontend.
- Click on the 'Upload DICOM' button.
- Select and upload a directory that only contains non-DICOM files (e.g., text files or
.mdfiles). - See the generic error toast on the UI and the 500 crash in the backend server logs.
Expected Behavior
The frontend should perform pre-flight validation on the filesArray. If no valid files are found, it should intercept the upload, prevent the API call, and show a clear, context-aware error toast (e.g., "No valid DICOM files found...").
Actual Behavior
The frontend fires an empty FormData payload, crashing the server and leaving the user confused by a generic error.
Environment
- OS: Ubuntu 24.04.4 LTS
- Browser: Chrome
- Node.js Version: 20.0.0
Additional Context
This is a critical UX issue that also wastes server bandwidth. I have a fix ready that introduces strict pre-flight validation in uploadHandlers.ts and will open a PR for it.
