diff --git a/internal/reader/media/media.go b/internal/reader/media/media.go index 8c78d7a5..a3765f64 100644 --- a/internal/reader/media/media.go +++ b/internal/reader/media/media.go @@ -9,7 +9,7 @@ import ( "strings" ) -var textLinkRegex = regexp.MustCompile(`(?mi)(\bhttps?://[^\s]+)[.]?(?:\s|$)`) +var textLinkRegex = regexp.MustCompile(`(?mi)(\bhttps?://[^\s]+)`) // Specs: https://www.rssboard.org/media-rss type MediaItemElement struct { @@ -154,8 +154,8 @@ func (d *Description) HTML() string { return d.Description } - content := strings.ReplaceAll(d.Description, "\n", "
") - return textLinkRegex.ReplaceAllString(content, `${1}`) + content := textLinkRegex.ReplaceAllString(d.Description, `${1}`) + return strings.ReplaceAll(content, "\n", "
") } // DescriptionList represents a list of "media:description" XML elements. diff --git a/internal/reader/media/media_test.go b/internal/reader/media/media_test.go index c3e943ca..b6275f56 100644 --- a/internal/reader/media/media_test.go +++ b/internal/reader/media/media_test.go @@ -83,6 +83,8 @@ func TestDescription(t *testing.T) { {"", "", ""}, {"html", "a c", "a c"}, {"plain", "a\nhttp://www.example.org/", `a
http://www.example.org/`}, + {"plain", "Link: https://example.com/path\n\nAnother: https://example.org", + `Link: https://example.com/path

Another: https://example.org`}, } for _, scenario := range scenarios {