umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.41k stars 2.66k forks source link

Media upload return unknown error and second have no response #14310

Closed laputaworkuk closed 1 year ago

laputaworkuk commented 1 year ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

11.4

Bug summary

In appsetting, I have add "Runtime": { "MaxQueryStringLength": 90, "MaxRequestLength": 1000 } which restrict upload over 1mb The first time, when I upload 3mb file, it return Error: An unknown error occurred Max file size is "1000KB" as expected, but the second time, it have no response, when I inspected, the console have provide error like below :

`data":{"ExceptionMessage":"Object reference not set to an instance of an object.","ExceptionType":"System.NullReferenceException, 
System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","StackTrace":"   
at Umbraco.Cms.Web.BackOffice.Controllers.MediaController.PostAddFile(String path, String currentFolder, String contentTypeAlias, List`1 file)\r\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)\r\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"},"status":500,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/umbraco/backoffice/umbracoapi/media/PostAddFile","fields":{"currentFolder":"11025","contentTypeAlias":"umbracoAutoSelect","propertyAlias":"umbracoFile"},"file":{"$error":"maxSize","$errorMessages":{"maxSize":true},"$errorParam":"1000KB","key":"04045f2b-fc30-4309-9b51-b9b1c6324901","messages":[]},"_isDigested":true,"_chunkSize":null,"headers":{"Accept":"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest","X-UMB-CULTURE":"en-GB","X-UMB-SEGMENT":null,"X-UMB-XSRF-TOKEN":"CfDJ8KHpP_QJKXFMo0vhgKjfj8vdhZvh9p3LDXtPeU4iBVidfCeAWGx_iSqMuJ8Zjs-gx8Dn1ZS3XHzO0iIkq5f7mqWYDL75-TggfqlOkK4cvK0kKwDVBKohy1_kOuvy4xlGX1aLbxrbfCotXaY4iDQaYM5M3mmTV0cztcWx57TRIHmE5-Q2usApF4Vudiyd5Zbh9g"},"_deferred":{"promise":{}}},"statusText":"","xhrStatus":"complete"}
(anonymous) @ angular.js:15697`

Specifics

No response

Steps to reproduce

In the appsetting the configuration is

"CMS": {
      "RuntimeMinification": {
        "UseInMemoryCache": true,
        "CacheBuster": "Timestamp"
      },
      "Runtime": {
        "MaxQueryStringLength": 90,
        "MaxRequestLength": 1000
      }
    }
  }

Upload the first big file can return error, but the second have no response

Expected result / actual result

It should always return error if file is oversize

github-actions[bot] commented 1 year ago

Hi there @laputaworkuk!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

elit0451 commented 1 year ago

Hi @laputaworkuk 👋

Thanks for reaching out! I've managed to reproduce this and I am marking it as up for grabs as we would like some help with it 🙂

laputaworkuk commented 1 year ago

Hi @elit0451 Thank you for your help, if you have any update, please let me know Thank you

github-actions[bot] commented 1 year ago

Hi @laputaworkuk,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)

Sander-Los commented 1 year ago

We are having the same issue on Umbraco 10.4.0 (and not seeing a fix in the releases afterwards) of not seeing an error message

laputaworkuk commented 1 year ago

This will impact on limited upload image size feature, or if someone upload too large image it will restart the service

elit0451 commented 1 year ago

It seems like on 10.4, we get the error below each time we upload a bigger image.

And the reason why you @Sander-Los, don't see a fix in the releases afterwards is that as far as I know, this issue is not a regression one and therefore, it is marked as up for grabs. There doesn't seem to be a fix for it yet, as no one has picked it up yet 🙂 image (2)

laputaworkuk commented 1 year ago

So can we have any workaround solution which can limited upload file size and can allow user reupload media without error ?

elit0451 commented 1 year ago

@laputaworkuk We are looking into this issue

iOvergaard commented 1 year ago

Fixed for V10 with #14578 and will be available in the next release. Fixed for V12 with #14579 and will be available in 12.1.0.

Cherry-picked for V11 with 24844c6ce25c66c113e7b6ed2f9f900c624a0cdb and will be available in the (as of yet unknown) next release.