Fix copy document with descendants onto self (#17661)
* Filter self out of descedants for self onto self copy * Optimized code --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
@@ -2699,6 +2699,13 @@ public class ContentService : RepositoryService, IContentService
|
||||
GetPagedDescendants(content.Id, page++, pageSize, out total);
|
||||
foreach (IContent descendant in descendants)
|
||||
{
|
||||
// when copying a branch into itself, the copy of a root would be seen as a descendant
|
||||
// and would be copied again => filter it out.
|
||||
if (descendant.Id == copy.Id)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// if parent has not been copied, skip, else gets its copy id
|
||||
if (idmap.TryGetValue(descendant.ParentId, out parentId) == false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user