Umbraco content api returns incorrect blocklist data when calling from umbracoapicontroller / umbracosurfacecontroller
When retrieving content via api we get the wrong data in blocklists. Only on some pages. Some pages consistently returns the right data and some consistently returns the wrong data.
If we look at the page rendered in an Umbraco view - content is rendered correct.
IIRC the issue happens when blocks on two different pages share the same GUID key.
If this can be reproduced by creating a new page from a content template, I'd say this is a bug in Umbraco.
We had the issue with one of our sites. I don't know whether this was caused by content templates, or some other form of copying content. I think I tested a few scenarios where I couldn't reproduce duplicate keys.
Anyways, I ended up writing some quick code to run through the affected pages and replace the GUID keys with randomly generated GUIDs (I don't think I have the code anymore).
Umbraco content api returns incorrect blocklist data when calling from umbracoapicontroller / umbracosurfacecontroller
When retrieving content via api we get the wrong data in blocklists. Only on some pages. Some pages consistently returns the right data and some consistently returns the wrong data.
If we look at the page rendered in an Umbraco view - content is rendered correct.
This works in the view:
Here are some examples that doesnt work
Example 1 : The umbracoapicontroller
In the controller we get data like this:
Example 2 : The umbracoapicontroller and umbracohelper
In the controller we get data like this:
*Example 3: The Umbraco Surface controller *
Same difference in all 3 examples. If I debug and inspect
content
I can find examples where one or more of the blocks in the block list is wrong.I can fix the problem
A few things tried:
If the editor, in Umbraco updates the block - the problem remains the same.
If the editor, in Umbraco sorts / moves the block - the problem remains the same.
If the editor copies the block and insert a new copy - the problem is fixed
Some facts
Problem was first spotted on a solution running on an Umbraco.sdf. We've tested migrating to sqlexpress. Problem still there.
Discovered in Umb 8.14.1. Upgraded to latest 8.18.4. Problem still there.
Seen this b4? Any hints?
😀
Update:
I have traced the problem into page created with content from "Content Templates".
Didnt find the reason behind.
IIRC the issue happens when blocks on two different pages share the same GUID key.
If this can be reproduced by creating a new page from a content template, I'd say this is a bug in Umbraco.
We had the issue with one of our sites. I don't know whether this was caused by content templates, or some other form of copying content. I think I tested a few scenarios where I couldn't reproduce duplicate keys.
Anyways, I ended up writing some quick code to run through the affected pages and replace the GUID keys with randomly generated GUIDs (I don't think I have the code anymore).
Thanks for confirming my finding, Anders ( IIRC I was close to loosing my mind at that time ).
ps. IIRC - had to look it up but I'll prefix everything with that from now on.
is working on a reply...