mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/views: escape HTML
This lets client use < > in tag names.
This commit is contained in:
@ -224,6 +224,15 @@ function makeCssName(text, suffix) {
|
||||
return suffix + '-' + text.replace(/[^a-z0-9]/g, '_');
|
||||
}
|
||||
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
range: range,
|
||||
formatSearchQuery: formatSearchQuery,
|
||||
@ -236,5 +245,6 @@ module.exports = {
|
||||
enableExitConfirmation: enableExitConfirmation,
|
||||
disableExitConfirmation: disableExitConfirmation,
|
||||
confirmPageExit: confirmPageExit,
|
||||
escapeHtml: escapeHtml,
|
||||
makeCssName: makeCssName,
|
||||
};
|
||||
|
Reference in New Issue
Block a user