Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/settings/js/vue-settings-personal-security.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-personal-security.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/src/components/AuthTokenSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<template>
<div id="security" class="section">
<h2>{{ t('settings', 'Devices & sessions') }}</h2>
<h2>{{ t('settings', 'Devices & sessions', {}, undefined, {sanitize: false}) }}</h2>
<p class="settings-hint hidden-when-empty">
{{ t('settings', 'Web, desktop and mobile clients currently logged in to your account.') }}
</p>
Expand Down
33 changes: 33 additions & 0 deletions core/js/dist/files_client.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/js/dist/files_client.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions core/js/dist/files_fileinfo.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/js/dist/files_fileinfo.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions core/js/dist/files_iedavclient.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/js/dist/files_iedavclient.js.map

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions core/js/dist/install.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/js/dist/install.js.map

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions core/js/dist/login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/login.js.map

Large diffs are not rendered by default.

102 changes: 51 additions & 51 deletions core/js/dist/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/main.js.map

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions core/js/dist/maintenance.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/maintenance.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions core/js/dist/recommendedapps.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/recommendedapps.js.map

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions core/src/OC/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
}
)
Expand All @@ -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)
}
},

Expand Down