Loading
Show the real error message in the upload file modal
What does this MR do and why?
Fixes the upload dialog hiding the true error message when a file upload fails. Previously, the catch block in upload_blob_modal.vue always displayed a hardcoded generic error string ('Error uploading file. Please try again.') and used createAlert to render it -- which placed the alert outside the modal, hidden behind the modal overlay.
The backend already returns the real error message in the JSON response ({ error: result[:message] }). This MR reads that message and displays it inside the modal using the existing error prop on CommitChangesModal, so no page reload is needed to see the actual error.
Closes #593964 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Create a test project in GDK with at least one file
- Go to the repository file browser and select
+> Upload file - Trigger an error by either:
- Uploading a file with the same name as one that already exists on the same branch
- Enabling a push rule under Settings > Repository > Push rules and uploading a file that violates one of the rules
- Setting a branch as protected with no push access and committing directly to it
- Before: a generic toast alert appears outside/behind the modal, and the real error is only visible after a page reload
- After: the real error message from the API is shown inline inside the modal immediately, with no reload needed
Related to #593964 (closed)
Edited by Joseph Fletcher