Ver Fonte

refactor: use given HTML config for DOMPurify

rugk há 8 meses atrás
pai
commit
ad55131831
1 ficheiros alterados com 3 adições e 4 exclusões
  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