Skip to content
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

Show UI errors for invalid files in media upload #11061

Merged
merged 3 commits into from
Sep 15, 2021

Conversation

madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented Sep 9, 2021

We don't get the invalid files from the uploader as part of the "files"-array anymore but instead as a separate array. I am not sure when this has changed.

This PR handles the new array of invalid files. It combines it with the files array, so everything works the way it used to.

After the PR is applied the errors are back in the UI.
Screenshot 2021-09-09 at 13 25 16

Relates to #10920

@nul800sebastiaan
Copy link
Member

Hmm, this works when I drag & drop files onto the drop zone but not when I pick files. In this case in web.config I have <requestLimits maxAllowedContentLength="5000" />

11061.mp4

The error is Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: file in rejected, Duplicate key: object:598, Duplicate value: {"$error":"maxSize","$errorMessages":{"maxSize":true},"$errorParam":"500KB"}

@madsrasmussen
Copy link
Contributor Author

In the Web.Config we have two values that influence how large files you can upload in the Backoffice: maxRequestLength and maxAllowedContentLength.

maxRequestLength is exposed to the client in "Umbraco.Sys.ServerVariables.umbracoSettings.maxFileSize". If a file exceeds this size, we let the client-side handle validation, and the file never hit the server. If maxRequestLength is larger than maxAllowedContentLength client-side validation doesn't kick in, and we get a server error that isn't handled.

I have added code to handle the server error now. We should expose maxAllowedContentLength to the client so we can do client-side validation for that also.

@nul800sebastiaan
Copy link
Member

nul800sebastiaan commented Sep 15, 2021

That looks good now, both drag & drop and "click to choose files" 👍

image

@nul800sebastiaan nul800sebastiaan changed the base branch from v8/dev to v8/8.17 September 15, 2021 07:18
@nul800sebastiaan nul800sebastiaan merged commit 09db4ed into v8/8.17 Sep 15, 2021
@nul800sebastiaan nul800sebastiaan deleted the v8/bugfix/no-errors-when-uploading-media branch September 15, 2021 07:18
elit0451 added a commit that referenced this pull request Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants