diff --git a/core/js/dist/files_client.js b/core/js/dist/files_client.js index 90253ef11f92dbc4d4aaed4d4cda2091f61d7820..0e91da672c570996966369802af90ba17015f039 100644 Binary files a/core/js/dist/files_client.js and b/core/js/dist/files_client.js differ diff --git a/core/js/dist/files_client.js.map b/core/js/dist/files_client.js.map index 8f0c8d0d010b5cb73e78ebbb16c59ab168da7cf4..038ba862646fc96945b178a9d76c8ea4b5e15bf1 100644 Binary files a/core/js/dist/files_client.js.map and b/core/js/dist/files_client.js.map differ diff --git a/core/js/dist/files_fileinfo.js b/core/js/dist/files_fileinfo.js index e2bbfef0c371b9671874468428e3289873cd6f28..bc4d81047d0d42879d355ce8d7415d64688f08f2 100644 Binary files a/core/js/dist/files_fileinfo.js and b/core/js/dist/files_fileinfo.js differ diff --git a/core/js/dist/files_fileinfo.js.map b/core/js/dist/files_fileinfo.js.map index 3c34aa8d6971a3a1f7ba13677fcea1f3d5c67ffa..a53454ef110cae631f4a673334f0c5ad6270c313 100644 Binary files a/core/js/dist/files_fileinfo.js.map and b/core/js/dist/files_fileinfo.js.map differ diff --git a/core/js/dist/files_iedavclient.js b/core/js/dist/files_iedavclient.js index 88df2ec0cb1e3d4411d72c53062fb38451bcf426..1cf8d9c08cb62c58c93d2e21534b5916dfe9383f 100644 Binary files a/core/js/dist/files_iedavclient.js and b/core/js/dist/files_iedavclient.js differ diff --git a/core/js/dist/files_iedavclient.js.map b/core/js/dist/files_iedavclient.js.map index 2ecb09181edab286329f172480ab939b5051f273..6f9a011e4e27b1785f1f09276a50302bba1bd39a 100644 Binary files a/core/js/dist/files_iedavclient.js.map and b/core/js/dist/files_iedavclient.js.map differ diff --git a/core/js/dist/install.js b/core/js/dist/install.js index 9456811660457740dc5291022f98cd0ff0fd5a4b..c5703edeb39ed7190e156a8551eee107d3cf5607 100644 Binary files a/core/js/dist/install.js and b/core/js/dist/install.js differ diff --git a/core/js/dist/install.js.map b/core/js/dist/install.js.map index 677244ce682f3e5205498b485de57e66aa16a721..82a7f5c0722594eceb62e5bee36b3b9c3d6a0d03 100644 Binary files a/core/js/dist/install.js.map and b/core/js/dist/install.js.map differ diff --git a/core/js/dist/login.js b/core/js/dist/login.js index 254ec34ddc221792df794e42df449b69f6c57cb9..328c661933bc03c5045450bc1dfac3c7f96b101c 100644 Binary files a/core/js/dist/login.js and b/core/js/dist/login.js differ diff --git a/core/js/dist/login.js.map b/core/js/dist/login.js.map index 418fd545269d31423689527cdbb893d115f764e5..33236be2bdaaa53ab727a9c129686752225e175e 100644 Binary files a/core/js/dist/login.js.map and b/core/js/dist/login.js.map differ diff --git a/core/js/dist/main.js b/core/js/dist/main.js index db70b561056a871c5412c8e37601994bc889e63d..f41bf3ca814c8946cf4560427e08023d76eec388 100644 Binary files a/core/js/dist/main.js and b/core/js/dist/main.js differ diff --git a/core/js/dist/main.js.map b/core/js/dist/main.js.map index 978de1183f5359a6b1ed34357d3b5a86b8f56750..9f5f2991de2fede530c133063fc4613099eca345 100644 Binary files a/core/js/dist/main.js.map and b/core/js/dist/main.js.map differ diff --git a/core/js/dist/maintenance.js b/core/js/dist/maintenance.js index dcb8cc1762a02ec20850f527fe22760448dd08de..8502038ae4e353380e34ba5f6bd6821593526a99 100644 Binary files a/core/js/dist/maintenance.js and b/core/js/dist/maintenance.js differ diff --git a/core/js/dist/maintenance.js.map b/core/js/dist/maintenance.js.map index 13212babc75d74aace0b2da7742a5f2c89c7feea..84a520b93d7037cda65b9a36486bd8bd18ec0018 100644 Binary files a/core/js/dist/maintenance.js.map and b/core/js/dist/maintenance.js.map differ diff --git a/core/js/dist/recommendedapps.js b/core/js/dist/recommendedapps.js index fe452b28a5b943a1655be28f64c25581d52be591..07b9731496191498e31e4fcf5e6224ac7ad04db3 100644 Binary files a/core/js/dist/recommendedapps.js and b/core/js/dist/recommendedapps.js differ diff --git a/core/js/dist/recommendedapps.js.map b/core/js/dist/recommendedapps.js.map index ed883fa5c5812aba54c1ad426c38a14fefca2fda..0f7a3757e54adf102cb0a0bb075f599fb4a33e40 100644 Binary files a/core/js/dist/recommendedapps.js.map and b/core/js/dist/recommendedapps.js.map differ diff --git a/core/src/OC/l10n.js b/core/src/OC/l10n.js index 5ada257d8588832776e05a7458f2e9fb8b5a3cbc..6495f514c7d1db6a1afe3f332ed674140bc4b5af 100644 --- a/core/src/OC/l10n.js +++ b/core/src/OC/l10n.js @@ -12,6 +12,7 @@ import _ from 'underscore' import $ from 'jquery' import DOMPurify from 'dompurify' import Handlebars from 'handlebars' +import identity from 'lodash/fp/identity' import escapeHTML from 'escape-html' import OC from './index' @@ -84,15 +85,20 @@ const L10n = { * @param {number} [count] number to replace %n with * @param {array} [options] options array * @param {bool} [options.escape=true] enable/disable auto escape of placeholders (by default enabled) + * @param {bool} [options.sanitize=true] enable/disable sanitization (by default enabled) * @returns {string} */ translate: function(app, text, vars, count, options) { const defaultOptions = { escape: true, + sanitize: true, } const allOptions = options || {} _.defaults(allOptions, defaultOptions) + const optSanitize = allOptions.sanitize ? DOMPurify.sanitize : identity + const optEscape = allOptions.escape ? escapeHTML : identity + // TODO: cache this function to avoid inline recreation // of the same function over and over again in case // translate() is used in a loop @@ -101,13 +107,9 @@ const L10n = { function(a, b) { const r = vars[b] if (typeof r === 'string' || typeof r === 'number') { - if (allOptions.escape) { - return DOMPurify.sanitize(escapeHTML(r)) - } else { - return DOMPurify.sanitize(r) - } + return optSanitize(optEscape(r)) } else { - return DOMPurify.sanitize(a) + return optSanitize(a) } } ) @@ -120,9 +122,9 @@ const L10n = { } if (typeof vars === 'object' || count !== undefined) { - return DOMPurify.sanitize(_build(translation, vars, count)) + return optSanitize(_build(translation, vars, count)) } else { - return DOMPurify.sanitize(translation) + return optSanitize(translation) } },