Altinn / Altinn/app-frontend-react
More describing error when uploading empty file in a FileUpload component.
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 33
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
### Description
I see that some users try to upload files repeatedly that have no content. It would be nice to make the user experience easier, minimizing failed upload attempts of corrupt/empty files.
When uploading an empty file, you get an error message describing that an error occured with the upload.

The datacontroller returns a 400 request "Empty stream provided. Cannot persist data", (https://github.com/Altinn/altinn-storage/blob/29d23e0a1c28d0f8174b814d071885623e8ed990/src/Storage/Controllers/DataController.cs#L294 )when the filecontent has a length of 0.
It would be nice to differentiate the error from the controller, and display a more descriptive message to the user, telling the user that the file is empty.
### Additional Information
_No response_
Contributor guide
Research direction
Start by locating the FileUpload component and reproduce an upload with an empty file to trace its current error handling. Compare the frontend behavior with the DataController response at the linked line, and consider the work done when empty files produce a distinct, descriptive message rather than the generic upload error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100