Skip to content

Commit

Permalink
Clean up Processed local image links in Management api (#16828)
Browse files Browse the repository at this point in the history
* Removed type attribute from processed local links

improved code readabilty by using multi return type to private class

* Removed type attribute from processed locallinks in delivery api

* Removed type attribute from expected output regarding locallink parsing

* Added type atttribute removal in deliveryapi for local image link and invalid local links

Test rename for clarity and
  • Loading branch information
Migaroez authored Jul 29, 2024
1 parent ceb86b6 commit f807960
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/Umbraco.Infrastructure/DeliveryApi/ApiRichTextMarkupParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@ private void ReplaceLocalLinks(HtmlDocument doc, IPublishedSnapshot publishedSna
link.SetAttributeValue("data-start-item-id", route.StartItem.Id.ToString("D"));
link.Attributes["type"]?.Remove();
},
url => link.SetAttributeValue("href", url),
() => link.Attributes.Remove("href"));
url =>
{
link.SetAttributeValue("href", url);
link.Attributes["type"]?.Remove();
},
() =>
{
link.Attributes.Remove("href");
link.Attributes["type"]?.Remove();
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void Can_Parse_LocalLinks()
}

[Test]
public void Can_Parse_Legacy_LocalImages()
public void Can_Parse_Inline_LocalImages()
{
var key1 = Guid.Parse("395bdc0e8f4d4ad4af7f3a3f6265651e");
var data1 = new MockData()
Expand Down

0 comments on commit f807960

Please sign in to comment.