umbraco-fluidity icon indicating copy to clipboard operation
umbraco-fluidity copied to clipboard

Microsoft Web API 5.2.7 causes issue with GetTreeNode and FormDataCollection

Open bythewiseman opened this issue 5 years ago • 4 comments

This is an known issue at Umbraco HQ and was fixed. Please see:

https://github.com/umbraco/Umbraco-CMS/issues/3796

And is easily fixed in the FluidityTreeController.cs file by changing:

public TreeNode GetTreeNode(string id, FormDataCollection queryStrings)

to

public TreeNode GetTreeNode(string id)

and add this line at the start of the method:

var queryStrings = new FormDataCollection(Request.RequestUri.Query.TrimStart('?'));

I have branched and fixed locally. Can I help by pushing this fix to you somehow?

bythewiseman avatar Nov 04 '19 11:11 bythewiseman

I am experiencing this issue as well on Umbraco 7.15.3. You get an error screen when you view an entry within a Fluidity section. Here's the error log entry:

 2020-01-17 14:33:09,097 [P12644/D7/T6] ERROR Fluidity.Web.Trees.FluidityTreeController - Unhandled controller exception occurred
System.Web.Http.HttpResponseException: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
   at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
   at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
   at System.Web.Http.ModelBinding.FormatterParameterBinding.<ExecuteBindingAsyncCore>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Controllers.HttpActionBinding.<ExecuteBindingAsyncCore>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()

Here's the error message from the failed request (it responds with an HTTP 415 code): "The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource."

I'm also happy to submit a pull request (though I note that the latest version of Fluidity was released well over a year ago, so not sure if it's being actively maintained).

Nicholas-Westby avatar Jan 17 '20 23:01 Nicholas-Westby

If you have a PR that works, then perhaps submit regardless, so at least others can fix locally.

c9mb avatar Jan 18 '20 00:01 c9mb

The above code changes would fix it locally. A PR would only be so the maintainers can easily merge it.

Nicholas-Westby avatar Jan 18 '20 00:01 Nicholas-Westby

FYI, I have verified that the above-mentioned fix works. I created a local release of Fluidity so I don't have to wait for the maintainers to release a new version. If anybody wants it, here are the files (zipped):

local-nuget.zip

If you are familiar with how to install NuGet packages from a folder on your file system, this should work for you. It is just the develop branch with the code fix mentioned above by @bythewiseman.

Nicholas-Westby avatar Jan 18 '20 02:01 Nicholas-Westby