Escape rss titles

Fixes #168
This commit is contained in:
Zed 2020-06-10 17:17:17 +02:00
parent 1811a23265
commit 07492b7b39
1 changed files with 5 additions and 3 deletions

View File

@ -69,6 +69,7 @@
#var title = profile.fullname #var title = profile.fullname
#if not multi: title &= " / " & user #if not multi: title &= " / " & user
#end if #end if
#title = xmltree.escape(title)
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel> <channel>
@ -100,7 +101,7 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel> <channel>
<atom:link href="${link}" rel="self" type="application/rss+xml" /> <atom:link href="${link}" rel="self" type="application/rss+xml" />
<title>${list.name} / @${list.username}</title> <title>${xmltree.escape(list.name)} / @${list.username}</title>
<link>${link}</link> <link>${link}</link>
<description>Twitter feed for: ${list.name} by @${list.username}. Generated by ${hostname}</description> <description>Twitter feed for: ${list.name} by @${list.username}. Generated by ${hostname}</description>
<language>en-us</language> <language>en-us</language>
@ -113,14 +114,15 @@
#proc renderSearchRss*(tweets: seq[Tweet]; name, param, hostname: string): string = #proc renderSearchRss*(tweets: seq[Tweet]; name, param, hostname: string): string =
#let prefs = Prefs(replaceTwitter: hostname, replaceYouTube: "invidio.us") #let prefs = Prefs(replaceTwitter: hostname, replaceYouTube: "invidio.us")
#let link = &"https://{hostname}/search" #let link = &"https://{hostname}/search"
#let escName = xmltree.escape(name)
#result = "" #result = ""
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel> <channel>
<atom:link href="${link}" rel="self" type="application/rss+xml" /> <atom:link href="${link}" rel="self" type="application/rss+xml" />
<title>Search results for "${name}"</title> <title>Search results for "${escName}"</title>
<link>${link}</link> <link>${link}</link>
<description>Twitter feed for search "${name}". Generated by ${hostname}</description> <description>Twitter feed for search "${escName}". Generated by ${hostname}</description>
<language>en-us</language> <language>en-us</language>
<ttl>40</ttl> <ttl>40</ttl>
${renderRssTweets(tweets, prefs, hostname)} ${renderRssTweets(tweets, prefs, hostname)}