From 613606fb88d4dd06d84455e60ab0229237da6b36 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jan 2021 14:44:39 +0100 Subject: Fix encoding issue with OC.Notification.show Signed-off-by: Joas Schilling --- core/src/OC/notification.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'core/src') diff --git a/core/src/OC/notification.js b/core/src/OC/notification.js index adac95f1d37..8b7e43373a6 100644 --- a/core/src/OC/notification.js +++ b/core/src/OC/notification.js @@ -115,9 +115,18 @@ export default { * @deprecated 17.0.0 use the `@nextcloud/dialogs` package */ show(text, options) { + const escapeHTML = function(text) { + return text.toString() + .split('&').join('&') + .split('<').join('<') + .split('>').join('>') + .split('"').join('"') + .split('\'').join(''') + } + options = options || {} options.timeout = (!options.timeout) ? TOAST_PERMANENT_TIMEOUT : options.timeout - const toast = showMessage(text, options) + const toast = showMessage(escapeHTML(text), options) toast.toastElement.toastify = toast return $(toast.toastElement) }, -- cgit v1.2.3