Skip to content

bug: Missing pre-flight validation on empty/invalid DICOM directory uploads causes 500 Server Error #31

Description

@chinmayy777

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

  1. Go to the OSIPI ASL Reporting Tool frontend.
  2. Click on the 'Upload DICOM' button.
  3. Select and upload a directory that only contains non-DICOM files (e.g., text files or .md files).
  4. 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.

Image Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions