Altinn / Altinn/app-frontend-react

More describing error when uploading empty file in a FileUpload component.

Open
#1,807 0 comments 0 reactions 0 assignees View on GitHub
area/attachments kind/feature-request
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.
![image](https://github.com/Altinn/app-frontend-react/assets/132340122/cd72641c-ea24-489c-b818-803d754d4706)

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.