-
Notifications
You must be signed in to change notification settings - Fork 2.8k
V16: XHR requests do not report the underlying problem details object #19160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iOvergaard
wants to merge
7
commits into
release/16.0
Choose a base branch
from
v16/bugfix/xhr-request-fail
base: release/16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…that back to the UmbApiError
…r a big "detail" string
…ly in case of special server errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes two issues: the loss of underlying problem details in XHR error responses and the improper handling of max file size validations for file uploads.
- Updated XHR request handling to properly extract and forward problem details.
- Migrated temporary file functionality from a repository to a manager implementation with enhanced error handling.
- Extended changes to user avatar and dictionary import components to incorporate the new temporary file manager.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/Umbraco.Web.UI.Client/src/packages/user/user/workspace/user/components/user-workspace-avatar/user-workspace-avatar.element.ts | Added allowed file types and temporary file configuration observation for avatar uploads. |
src/Umbraco.Web.UI.Client/src/packages/user/user/repository/avatar/user-avatar.repository.ts | Replaced the legacy temporary file repository with the new temporary file manager for avatar uploads. |
src/Umbraco.Web.UI.Client/src/packages/dictionary/entity-action/import/import-dictionary-modal.element.ts | Updated file upload handling to use the temporary file manager and manage import state. |
src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file.server.data-source.ts | Disabled notifications for temporary file uploads. |
src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts | Refactored file size validation and error handling with improved notification of file size limits. |
src/Umbraco.Web.UI.Client/src/packages/core/resources/tryXhrRequest.function.ts | Updated error rejection to use a centralized error response creator with problem details extraction. |
src/Umbraco.Web.UI.Client/src/packages/core/resources/try-execute.controller.ts | Improved error handling by extracting problem details through type validation. |
src/Umbraco.Web.UI.Client/src/packages/core/resources/api-interceptor.controller.ts | Enhanced interception logic to check for valid problem details and use them for error notifications. |
src/Umbraco.Web.UI.Client/src/packages/core/temporary-file/temporary-file-manager.class.ts
Outdated
Show resolved
Hide resolved
…porary-file-manager.class.ts Co-authored-by: Copilot <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/frontend
category/ux
User experience
preview/backoffice
Pull requests that can be previewed in a static version of the Backoffice
release/16.0.0
type/bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Two problems are solved here:
XHR Requests and Problem Details
XHR requests created through the UmbTryXhrRequestController did not map back the underlying problem details object, resulting in details being lost, which then resulted in a blank error notification as outlined in #19154. This has been fixed in the controller.
This now means that error notifications are shown again:

And this fixes #19154
MaxFileSize is not being detected
If the developer fails to inform us of the intended max file size (also known as the max request length), we have no way of using this to validate the file size before attempting an upload. This results in a 413 error on the server, which is then wrapped into a problem details object.
This Pull Request attempts to recognize these errors (at least when uploading temporary files) by disabling notifications and checking on the error itself in the UmbTemporaryFileManager. It also tries to guess what the max file size could be based on the server error.
So we get the friendly error even when the server failed the request:

This fixes #18994
Additionally
I went through the dictionary import and user avatar to ensure that they, too, use the UmbTemporaryFileManager, which will now correctly validate temporary file uploads, handle queueing (although that is negligible for singular file uploads), and support cancelling the file upload network request.
How to test
Test the default settings
All of this can be tested by going to any of the uploads, for example, user avatar, dictionary import, or media library "create" and then uploading a file that is too large. By default, this is 50 MB on Kestrel only if you have not set the
MaxRequestLength
in appsettings.Test an applied MaxRequestLength
Add this to your app settings:
Now, try and upload a file larger than 1 KB and it should fail directly on the client before even being attempted to upload.