This commit is contained in:
Elitsa Marinovska
2021-08-17 13:10:13 +02:00
parent d8b3a1bbe5
commit e9b697b0c2
9 changed files with 36 additions and 18 deletions

View File

@@ -42,9 +42,15 @@ namespace Umbraco.Cms.Core.Templates
/// <returns></returns>
public string EnsureInternalLinks(string text, bool preview)
{
var umbracoContext = _umbracoContextAccessor.GetRequiredUmbracoContext();
if (!_umbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
{
throw new InvalidOperationException("Could not parse internal links, there is no current UmbracoContext");
}
if (!preview)
{
return EnsureInternalLinks(text);
}
using (umbracoContext.ForcedPreview(preview)) // force for URL provider
{