]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix quota text shown escaped
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 23 Jun 2022 11:24:04 +0000 (13:24 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Tue, 5 Jul 2022 20:25:44 +0000 (20:25 +0000)
"t()" escapes and sanitizes the returned text by default, so strings
like "<" are converted to "&lt;". However, the "jQuery.text()" parameter
does not need to be escaped, as "&lt;" is shown literally as "&lt;"
rather than "<". Now "jQuery.html()" is used instead, which "unescapes"
the given text and sets it as a new text node (as the text in the
parameter does not contain markup for elements, only text).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
apps/files/js/files.js

index 8645719f82b0deefa0d5f3ef27e0dfec76b35bf2..5f00ce2cb225f39f5d970f07499046c9f0f1af58 100644 (file)
                                if (response.data.quota > 0) {
                                        $('#quota').attr('data-original-title', Math.floor(response.data.used/response.data.quota*1000)/10 + '%');
                                        $('#quota progress').val(response.data.usedSpacePercent);
-                                       $('#quotatext').text(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota}));
+                                       $('#quotatext').html(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota}));
                                } else {
-                                       $('#quotatext').text(t('files', '{used} used', {used: humanUsed}));
+                                       $('#quotatext').html(t('files', '{used} used', {used: humanUsed}));
                                }
                                if (response.data.usedSpacePercent > 80) {
                                        $('#quota progress').addClass('warn');