Skip to content

Commit

Permalink
Update htmlStringImgUrlConverter.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam7-1 authored Dec 28, 2024
1 parent 8087fe0 commit ebbda00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/peregrine/lib/util/htmlStringImgUrlConverter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import makeUrl from './makeUrl';
import resolveLinkProps from './resolveLinkProps';

import DOMPurify from 'dompurify';
/**
* Modifies html string images to use makeUrl as source and resolves links to use internal path.
*
Expand All @@ -9,7 +9,7 @@ import resolveLinkProps from './resolveLinkProps';
*/
const htmlStringImgUrlConverter = htmlString => {
const temporaryElement = document.createElement('div');
temporaryElement.innerHTML = htmlString;
temporaryElement.innerHTML = DOMPurify.sanitize(htmlString);
for (const imgElement of temporaryElement.getElementsByTagName('img')) {
imgElement.src = makeUrl(imgElement.src, {
type: 'image-wysiwyg',
Expand Down

0 comments on commit ebbda00

Please sign in to comment.