Skip to content

Unhandled Missing Document in Cloud Downloads #62

Description

@vibhutomer

Description

In Govt-Billing-React/src/firebase/firestore.ts, the downloadFileFromFirebase function retrieves a document from Firestore and attempts to mutate it without verifying if the document actually exists.

Impact

If a user attempts to download a file that has been deleted from another device, or if there is a network/permission desync, docSnapshot.data() will return undefined. Attempting to execute delete data["owner"] on an undefined object will cause a fatal JavaScript runtime error, crashing the application thread silently.

Proposed Solution

Add an explicit docSnapshot.exists() validation check inside the getFile helper function. If the document does not exist, throw a controlled error so it can be handled gracefully by the parent try...catch block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions