FindLegacyLocalLinkIds(string text)
{
// Parse internal links
MatchCollection tags = LocalLinkPattern.Matches(text);
@@ -153,15 +160,41 @@ public sealed class HtmlLocalLinkParser
var guidUdi = udi as GuidUdi;
if (guidUdi is not null)
{
- yield return (null, guidUdi, tag.Value);
+ yield return new LocalLinkTag(null, guidUdi, tag.Value, null);
}
}
if (int.TryParse(id, NumberStyles.Integer, CultureInfo.InvariantCulture, out var intId))
{
- yield return (intId, null, tag.Value);
+ yield return new LocalLinkTag (intId, null, tag.Value, null);
}
}
}
}
+
+ private class LocalLinkTag
+ {
+ public LocalLinkTag(int? intId, GuidUdi? udi, string tagHref)
+ {
+ IntId = intId;
+ Udi = udi;
+ TagHref = tagHref;
+ }
+
+ public LocalLinkTag(int? intId, GuidUdi? udi, string tagHref, string? fullTag)
+ {
+ IntId = intId;
+ Udi = udi;
+ TagHref = tagHref;
+ FullTag = fullTag;
+ }
+
+ public int? IntId { get; }
+
+ public GuidUdi? Udi { get; }
+
+ public string TagHref { get; }
+
+ public string? FullTag { get; }
+ }
}
diff --git a/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParser.cs b/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParser.cs
index 338966dc39..434a6ef16a 100644
--- a/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParser.cs
+++ b/src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParser.cs
@@ -60,6 +60,7 @@ internal sealed class ApiRichTextMarkupParser : ApiRichTextParserBase, IApiRichT
link.SetAttributeValue("href", route.Path);
link.SetAttributeValue("data-start-item-path", route.StartItem.Path);
link.SetAttributeValue("data-start-item-id", route.StartItem.Id.ToString("D"));
+ link.Attributes["type"]?.Remove();
},
url => link.SetAttributeValue("href", url),
() => link.Attributes.Remove("href"));
diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Templates/HtmlLocalLinkParserTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Templates/HtmlLocalLinkParserTests.cs
index 93b0d5bba3..6ef0f74e2f 100644
--- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Templates/HtmlLocalLinkParserTests.cs
+++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Templates/HtmlLocalLinkParserTests.cs
@@ -1,7 +1,6 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
-using System.Linq;
using Microsoft.Extensions.Options;
using Moq;
using NUnit.Framework;
@@ -13,7 +12,6 @@ using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Templates;
using Umbraco.Cms.Tests.Common;
using Umbraco.Cms.Tests.UnitTests.TestHelpers.Objects;
-using Umbraco.Extensions;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Templates;
@@ -111,10 +109,16 @@ public class HtmlLocalLinkParserTests
// current
[TestCase(
"world",
- "world")]
+ "world")]
[TestCase(
"world",
- "world")]
+ "world")]
+ [TestCase(
+ "world",
+ "world")]
+ [TestCase(
+ "world",
+ "world")]
// legacy
[TestCase(
"hello href=\"{localLink:1234}\" world ",
diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParserTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParserTests.cs
index 43ec2136f7..d9a7309577 100644
--- a/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParserTests.cs
+++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParserTests.cs
@@ -72,8 +72,8 @@ public class ApiRichTextMarkupParserTests
and to the other page
";
var expectedOutput =
- @"Rich text outside of the blocks with a link to itself
-and to the other page
";
+ @"Rich text outside of the blocks with a link to itself
+and to the other page
";
var parsedHtml = parser.Parse(html);