escape customer, project and activity name in javascript (#2959)

This commit is contained in:
Kevin Papst
2021-11-19 19:45:37 +01:00
committed by GitHub
parent 859131308a
commit 89bfa82c61
7 changed files with 23 additions and 7 deletions

View File

@@ -66,4 +66,19 @@ export default class KimaiPlugin {
return this.getContainer().getPlugin(name);
}
/**
* @param {string} title
* @returns {string}
*/
escape(title) {
const tagsToReplace = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
};
return title.replace(/[&<>]/g, function(tag) {
return tagsToReplace[tag] || tag;
});
};
}