Skip to content

Commit 0a904c1

Browse files
committed
fix: corrected HTML sanitizer configuration (#2497)
1 parent ee7fa51 commit 0a904c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

phpmyfaq/src/phpMyFAQ/Helper/FaqHelper.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,18 @@ public function createFaqTranslationLinkList(int $faqId, string $faqLang): strin
247247
*/
248248
public function cleanUpContent(string $content): string
249249
{
250-
$htmlSanitizer = Sanitizer::create(['extensions' => ['basic']]);
250+
$htmlSanitizer = Sanitizer::create(
251+
[
252+
'extensions' => [
253+
'basic', 'code', 'image', 'list', 'table', 'iframe', 'details', 'extra'
254+
],
255+
'tags' => [
256+
'img' => [
257+
'allowed_attributes' => ['src', 'alt', 'title', 'class', 'width', 'height'],
258+
],
259+
]
260+
]
261+
);
251262

252263
return $htmlSanitizer->sanitize($content);
253264
}

0 commit comments

Comments
 (0)