Skip to content

Commit

Permalink
UIU-3267 correctly import from dompurify (#2798)
Browse files Browse the repository at this point in the history
Import from `dompurify` as shown in example code; `sanitize` was never
deliberately provided as a named export. Not sure how this ever worked.

Refs UIU-3267

(cherry picked from commit 43613fa)
  • Loading branch information
zburke committed Nov 14, 2024
1 parent 362caa0 commit e1836ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change history for ui-users

## 11.0.3 IN PROGRESS

* Correctly import from `dompurify`. Refs UIU-3267.

## [11.0.2](https://github.com/folio-org/ui-users/tree/v11.0.2) (2024-11-08)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.1...v11.0.2)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@
},
"dependencies": {
"compressorjs": "^1.2.1",
"dompurify": "^3.1.7",
"dompurify": "^3.2.0",
"final-form-set-field-data": "^1.0.2",
"get-orientation": "^1.1.2",
"hashcode": "^1.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import Barcode from 'react-barcode';
import PropTypes from 'prop-types';
import HtmlToReact, { Parser } from 'html-to-react';
import { sanitize } from 'dompurify';
import DOMPurify from 'dompurify';

const processNodeDefinitions = new HtmlToReact.ProcessNodeDefinitions(React);
const rules = [
Expand All @@ -20,7 +20,7 @@ const rules = [
const parser = new Parser();

const PrintTemplate = ({ dataSource, templateFn }) => {
const componentStr = sanitize(templateFn(dataSource), { ADD_TAGS: ['Barcode'] });
const componentStr = DOMPurify.sanitize(templateFn(dataSource), { ADD_TAGS: ['Barcode'] });
const Component = parser.parseWithInstructions(componentStr, () => true, rules) || null;

return Component;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5901,10 +5901,10 @@ dompurify@^3.0.9:
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.1.tgz#e83de1e0ba7f1014f36686fbc63a2a3a1bdb93f6"
integrity sha512-tVP8C/GJwnABOn/7cx/ymx/hXpmBfWIPihC1aOEvS8GbMqy3pgeYtJk1HXN3CO7tu+8bpY18f6isjR5Cymj0TQ==

dompurify@^3.1.7:
version "3.1.7"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.7.tgz#711a8c96479fb6ced93453732c160c3c72418a6a"
integrity sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==
dompurify@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.2.0.tgz#53c414317c51503183696fcdef6dd3f916c607ed"
integrity sha512-AMdOzK44oFWqHEi0wpOqix/fUNY707OmoeFDnbi3Q5I8uOpy21ufUA5cDJPr0bosxrflOVD/H2DMSvuGKJGfmQ==

domutils@^2.5.2, domutils@^2.8.0:
version "2.8.0"
Expand Down

0 comments on commit e1836ff

Please sign in to comment.