1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Escape HTML when generating changelog

This commit is contained in:
Laurent Cozic 2020-10-20 17:16:09 +01:00
parent 03063f1137
commit 5292fc1402

View File

@ -8,6 +8,16 @@ require('app-module-path').addPath(`${__dirname}/../ReactNativeClient`);
const { execCommand, githubUsername } = require('./tool-utils.js');
// From https://stackoverflow.com/a/6234804/561309
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}
async function gitLog(sinceTag) {
let lines = await execCommand(`git log --pretty=format:"%H::::DIV::::%ae::::DIV::::%an::::DIV::::%s" ${sinceTag}..HEAD`);
lines = lines.split('\n');
@ -245,7 +255,7 @@ function formatCommitMessage(msg, author, options) {
output = output.replace(/\((#[0-9]+)\)$/, '');
}
return output;
return escapeHtml(output);
}
function createChangeLog(logs, options) {