Merge pull request #3238 from sbwalker/dev

fix #3229 - changing page path in Edot Page when invoked from Control Panel results in 404 when redirecting
This commit is contained in:
Shaun Walker 2023-09-08 10:35:52 -04:00 committed by GitHub
commit a1e5912d37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}
}