Escape & in URLs.
All checks were successful
the build was successful

This commit is contained in:
tastytea 2019-04-22 12:20:44 +02:00
parent 0e24f0433c
commit 820d1b8e17
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.2)
project(gitea2rss
VERSION 0.4.3
VERSION 0.4.4
LANGUAGES CXX
)

View File

@ -51,7 +51,7 @@ this in it:
href="https://rss.example.com/?repo={{.Repository.Owner.Name}}/{{.Repository.Name}}"/>
<link rel="alternate" type="application/rss+xml"
title="Tags of {{.Repository.Name}}"
href="https://rss.example.com/?repo={{.Repository.Owner.Name}}/{{.Repository.Name}}&type=tags"/>
href="https://rss.example.com/?repo={{.Repository.Owner.Name}}/{{.Repository.Name}}&amp;type=tags"/>
{{end}}
----

View File

@ -15,6 +15,7 @@
*/
#include <iostream>
#include <regex>
#include <cstdlib>
#include "version.hpp"
#include "gitea2rss.hpp"
@ -58,6 +59,7 @@ void write_preamble(const string &url, const string &type)
selfurl = "http://";
}
selfurl += string(server_name) + request_uri;
selfurl = std::regex_replace(selfurl, std::regex("&"), "&amp;");
}
cout << "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"