Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Flux RSS Error #299

Open
liberodark opened this issue Aug 16, 2019 · 2 comments
Open

Flux RSS Error #299

liberodark opened this issue Aug 16, 2019 · 2 comments

Comments

@liberodark
Copy link

liberodark commented Aug 16, 2019

Hi,

Use RSS on my room but is not work great with - :
The bug is on web and desktop version.

RSS Link on Riot :
https://www.domain.ch/link/jeu-vidéo/linux/489499-test+1+4+nano

The correct link
https://www.domain.ch/link/jeu-vidéo/linux/489499-test+1+4+nano

Best Regards

@liberodark
Copy link
Author

liberodark commented Aug 16, 2019

For more information :
By Fervex

Looking fast, the blocking part would situate here (line 351-353) :

func itemToHTML(feed *gofeed.Feed, item gofeed.Item) gomatrix.HTMLMessage {
return gomatrix.HTMLMessage{
Body: fmt.Sprintf("%s: %s ( %s )",
html.EscapeString(feed.Title), html.EscapeString(item.Title), html.EscapeString(item.Link)),
MsgType: "m.notice",
Format: "org.matrix.custom.html",
FormattedBody: fmt.Sprintf("<strong>%s</strong>:<br><a href=\"%s\"><strong>%s</strong></a>",
html.EscapeString(feed.Title), html.EscapeString(item.Link), html.EscapeString(item.Title)),
// <strong>FeedTitle</strong>:
// <br>
// <a href="url-of-the-entry"><strong>Title of the Entry</strong></a>
}
}

Looking at one end of the doc : https://golang.org/pkg/html/ and more specifically here
https://golang.org/src/html/escape.go?s=4699:4735#L177
We see that UnescapeString et EscapeString are responsible for transformations in html entity. So I'll have to think of seeing a UnescapeString (but no) we only have it for the "description" and "title" on line 328 but not for the link :


i.Title = html.UnescapeString(i.Title)
i.Description = html.UnescapeString(i.Description)

So to test on that side !

@liberodark
Copy link
Author

liberodark commented Aug 16, 2019

Probable fix with ? :

func itemToHTML(feed *gofeed.Feed, item gofeed.Item) gomatrix.HTMLMessage {
	return gomatrix.HTMLMessage{
		Body: fmt.Sprintf("%s: %s ( %s )",
			html.UnescapeString(feed.Title), html.UnescapeString(item.Title), html.EscapeString(item.Link)),
		MsgType: "m.notice",
		Format: "org.matrix.custom.html",
		FormattedBody: fmt.Sprintf("<strong>%s</strong>:<br><a href=\"%s\"><strong>%s</strong></a>",
			html.EscapeString(feed.Title), html.EscapeString(item.Link), html.EscapeString(item.Title)),
			// <strong>FeedTitle</strong>:
			// <br>
			// <a href="url-of-the-entry"><strong>Title of the Entry</strong></a>
	  }
}

liberodark added a commit to liberodark/go-neb that referenced this issue Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant