Просмотр исходного кода

refactor: use given HTML config for DOMPurify

rugk 8 месяцев назад
Родитель
Сommit
ad55131831
1 измененных файлов с 3 добавлено и 4 удалено
  1. 3 4
      js/privatebin.js

+ 3 - 4
js/privatebin.js

@@ -812,12 +812,11 @@ jQuery.PrivateBin = (function($) {
 
             if (containsHtml) {
                 // only allow tags/attributes we actually use in translations
-                output = DOMPurify.sanitize(
-                    output, {
+                const sanitizeConfig = Object.assign({}, purifyHtmlConfig, {
                         ALLOWED_TAGS: ['a', 'i', 'span', 'kbd'],
                         ALLOWED_ATTR: ['href', 'id']
-                    }
-                );
+                });
+                output = DOMPurify.sanitize(output, sanitizeConfig);
             }
 
             // if $element is given, insert translation