Merge pull request #25244 from nextcloud/backport/25234/stable20

[stable20] Fix encoding issue with OC.Notification.show
This commit is contained in:
Roeland Jago Douma 2021-01-23 10:47:29 +01:00 committed by GitHub
commit 5663d3e463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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('&lt;')
.split('>').join('&gt;')
.split('"').join('&quot;')
.split('\'').join('&#039;')
}
options = options || {}
options.timeout = (!options.timeout) ? -1 : options.timeout
const toast = showMessage(text, options)
const toast = showMessage(escapeHTML(text), options)
toast.toastElement.toastify = toast
return $(toast.toastElement)
},