fix #3229 - changing page path in Edot Page when invoked from Control Panel results in 404 when redirecting

This commit is contained in:
sbwalker 2023-09-08 10:35:22 -04:00
parent 4a20be8b34
commit 037f1ec887

View File

@ -280,16 +280,10 @@ namespace Oqtane.Controllers
if (currentPage.Path != page.Path)
{
var urlMapping = _urlMappings.GetUrlMapping(page.SiteId, currentPage.Path);
if (urlMapping == null)
if (urlMapping != null)
{
urlMapping = new UrlMapping();
urlMapping.SiteId = page.SiteId;
urlMapping.Url = currentPage.Path;
urlMapping.MappedUrl = page.Path;
urlMapping.Requests = 0;
urlMapping.CreatedOn = System.DateTime.UtcNow;
urlMapping.RequestedOn = System.DateTime.UtcNow;
_urlMappings.AddUrlMapping(urlMapping);
_urlMappings.UpdateUrlMapping(urlMapping);
}
}