Vulnerability in EPiServer.Forms
We are getting the exceptions below when trying to export pages from the CMS. (EPiServer.dll 184.108.40.206)
The pages work fine, i.e.: we can browse to them and they display correctly without any errors being logged.
When exporting said pages, we get these errors and the pages are not exported.
Has anyone faced the same problem in the past and does anyone have any tips on how to troubleshoot this?
2014-08-01 11:26:03,141  WARN EPiServer.Core.Transfer.TransferLogger: 10.5.2 Export/import warning: [Exporting content 11451] Failed to export property MainContentArea, exception: Sequence contains more than one matching element2014-08-01 11:26:03,141  ERROR EPiServer.Core.Transfer.TransferLogger: Export/import Exception: System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at EPiServer.Core.Transfer.DependentContentTransfer.ExportDependentContent(IContent content) at EPiServer.Core.Transfer.ContentFragmentTransfer.ExportContentFragment(ContentFragment contentFragment) at EPiServer.Core.Transfer.PropertyContentAreaTransform.ExportEventHandler(Object sender, TransformPropertyEventArgs e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at EPiServer.Core.Transfer.ContentTransfer.ExportProperties(RawContent contextContent, RawProperty properties, String masterLanguage)
When looking in code it reveals that it fails because there are a ContentAssetFolder beneath another ContentAssetFolder instance. This is not expected. ContentAssetFolder instances are only expected to be found as direct children to ContentAssetRoot folder (never nested).
If you in edit mode go to content item with id 11415 (e.g. by replacing the id parameter in the url) and there look in the block gadget and there look in folder "For this Page"/"For this block" what do you see there??
I opened page 11451 and checked the blocks gadget.
The "For this page" folder is empty, it does not have any blocks (or images, if I switch to media view).
The "MainContentArea" of the page has 2 blocks, both stored in the "For all sites" section:
1 - For All Sites> (client name)>Sites> (country1)> media>Funds overview_adviser
2 - For All Sites> (client name)>Sites> (country2)>unstructured content> Ceiling Banner
On your comment "ContentAssetFolder instances are only expected to be found as direct children to ContentAssetRoot folder (never nested).":
We are creating the asset folders programmatically in the shared blocks section (via an import service to migrate data from an external source into blocks).
Looking at the import service code, all the child folders are being created with type "ContentAssetFolder".
I'm assuming the type of the child folders should be "ContentFolder" instead?
Also I'll try changing the type of the existing folder from "ContentAssetFolder" to "ContentFolder" and see how the export goes.
Thanks for your help,
So changing the folder type from "ContentAssetFolder" to "ContentFolder" in our migration tool and updating the content type in the database for the existing migrated blocks fixed this issue.
Thanks for your help.
Just to double check, does this mean the "For This Page" asset folders should be of "ContentAssetFolder" and any children of "ContentFolder"?
Yes that is correct.
The suggestion is to use ContentAssetHelper.GetAssetFolder method to get the asset folder for a specific content instance.
Then if you need to create subfolders then they should be of type ContentFolder.
Cheers, thanks you.