浏览代码

refactor: use given HTML config for DOMPurify

rugk 10 月之前
父节点
当前提交
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