URL segment is not unique after moving pages and creating new pages

Found in

EPiServer.CMS.Core 11.16.0

Fixed in

EPiServer.CMS.Core 11.20.0

Created

Jul 02, 2020

Updated

Oct 08, 2020

Area

CMS Core

State

Closed, Fixed and tested


Description

This issue is somewhat tricky to reproduce - please see the attached screencast for demonstration on how to reproduce the issue an Alloy site.

written steps to reproduce:

1. Create a new page with URL segment "Test en", language "en" and publish.
2. Create a translation with URL segment "Test sv", language "sv" and publish.
3. Select current editing language to "en".
4. Move the page to a different location like Page C.
5- Move the to wastebasket or other place ( it does not need to be wastebasket)
5. Create another page to the location Page C by repeating steps 1 and 2.
-> On translated page the "Name in URL" property show "test-sv2". It should show "test-sv", because there isn't a page with the same URL segment at the same level.
6. On translated page, set the "Name in URL" property to "test-sv" and publish.
-> An error occurs: Something went wrong "Name in URL" with value "test-sv" is already in use by Test sv (<ContentId>).

<ContentId> is refererring to the moved page.

I created an eventhandler that clears the content provider's cache after moving content to ensure that the problem is with the cache:

private void ContentEvents_MovedContent(object sender, ContentEventArgs e)
{
var contentProviderManager = ServiceLocator.Current.GetInstance<IContentProviderManager>();
var contentprovider = contentProviderManager.GetProvider(e.ContentLink.ProviderName);
contentprovider.ClearProviderPagesFromCache();
}

If the cache is cleared, there will be no issues mentioned above.

Expected: : Name in URL is "test-sv"
Actual: Name in URL is "test-sv2"

Also used
<package id="EPiServer.Labs.LanguageManager" version="4.0.0"