escaped text for html export

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-07-04 17:48:20 +03:00
parent 50dae9d4f3
commit 9b02c31f8d
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -26,9 +26,9 @@ QString toHTML(QList<Mod*> mods, OptionalData extraData)
QStringList lines; QStringList lines;
for (auto mod : mods) { for (auto mod : mods) {
auto meta = mod->metadata(); auto meta = mod->metadata();
auto modName = mod->name(); auto modName = mod->name().toHtmlEscaped();
if (extraData & Url) { if (extraData & Url) {
auto url = mod->metaurl(); auto url = mod->metaurl().toHtmlEscaped();
if (!url.isEmpty()) if (!url.isEmpty())
modName = QString("<a href=\"%1\">%2</a>").arg(url, modName); modName = QString("<a href=\"%1\">%2</a>").arg(url, modName);
} }
@ -38,10 +38,10 @@ QString toHTML(QList<Mod*> mods, OptionalData extraData)
if (ver.isEmpty() && meta != nullptr) if (ver.isEmpty() && meta != nullptr)
ver = meta->version().toString(); ver = meta->version().toString();
if (!ver.isEmpty()) if (!ver.isEmpty())
line += QString(" [%1]").arg(ver); line += QString(" [%1]").arg(ver.toHtmlEscaped());
} }
if (extraData & Authors && !mod->authors().isEmpty()) if (extraData & Authors && !mod->authors().isEmpty())
line += " by " + mod->authors().join(", "); line += " by " + mod->authors().join(", ").toHtmlEscaped();
lines.append(QString("<li>%1</li>").arg(line)); lines.append(QString("<li>%1</li>").arg(line));
} }
return QString("<html><body><ul>\n\t%1\n</ul></body></html>").arg(lines.join("\n\t")); return QString("<html><body><ul>\n\t%1\n</ul></body></html>").arg(lines.join("\n\t"));