Skip to content

Commit 9c5b02a

Browse files
Merge pull request #61 from contentstack/next
sre issue fix
2 parents 905a1f0 + 0a83383 commit 9c5b02a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/helper/regex-match.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ export function matchFigureTag(content: string): string[] | null {
1010
const matches: string[] = [];
1111
const openingTag = '<figure';
1212
const closingTag = '</figure>';
13-
let startIndex = 0;
14-
while ((startIndex = content.indexOf(openingTag, startIndex)) !== -1) {
13+
let startIndex = content.indexOf(openingTag);
14+
while (startIndex !== -1) {
1515
const endIndex = content.indexOf(closingTag, startIndex);
1616
if (endIndex !== -1 && endIndex > startIndex) {
1717
matches.push(content.substring(startIndex, endIndex + closingTag.length));
18-
startIndex = endIndex + closingTag.length;
18+
startIndex = content.indexOf(openingTag, endIndex + closingTag.length);
1919
} else {
2020
console.error('Malformed figure tag found in content');
2121
break;
2222
}
23-
}
23+
}
2424
return matches.length > 0 ? matches : null;
2525
}
2626

src/options/default-options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import * as DOMPurify from 'dompurify';
88
export const defaultOptions: RenderOption = {
99
[StyleType.BLOCK]: (item: EmbeddedItem | EntryNode) => {
1010
const title = DOMPurify.sanitize(item.title || item.uid);
11-
const content_type_uid = DOMPurify.sanitize(item._content_type_uid || (item.system ? item.system.content_type_uid : ''));
12-
return `<div><p>${title}</p><p>Content type: <span>${content_type_uid}</span></p></div>`;
11+
const contentTypeUid = DOMPurify.sanitize(item._content_type_uid || (item.system ? item.system.content_type_uid : ''));
12+
return `<div><p>${title}</p><p>Content type: <span>${contentTypeUid}</span></p></div>`;
1313
},
1414
[StyleType.INLINE]: (item: EmbeddedItem | EntryNode) => {
1515
const title = DOMPurify.sanitize(item.title || item.uid);

0 commit comments

Comments
 (0)