Merge pull request #9852 from MrPetovan/bug/9846-tags-img-desc

Prevent hashtag parsing and replacement in image alternative text
This commit is contained in:
Michael Vogel 2021-01-23 08:03:53 +01:00 committed by GitHub
commit d5e87011c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -2066,7 +2066,7 @@ class BBCode
{ {
$ret = []; $ret = [];
BBCode::performWithEscapedTags($string, ['noparse', 'pre', 'code'], function ($string) use (&$ret) { BBCode::performWithEscapedTags($string, ['noparse', 'pre', 'code', 'img'], function ($string) use (&$ret) {
// Convert hashtag links to hashtags // Convert hashtag links to hashtags
$string = preg_replace('/#\[url\=([^\[\]]*)\](.*?)\[\/url\]/ism', '#$2 ', $string); $string = preg_replace('/#\[url\=([^\[\]]*)\](.*?)\[\/url\]/ism', '#$2 ', $string);

View File

@ -1866,7 +1866,7 @@ class Item
public static function setHashtags($body) public static function setHashtags($body)
{ {
$body = BBCode::performWithEscapedTags($body, ['noparse', 'pre', 'code'], function ($body) { $body = BBCode::performWithEscapedTags($body, ['noparse', 'pre', 'code', 'img'], function ($body) {
$tags = BBCode::getTags($body); $tags = BBCode::getTags($body);
// No hashtags? // No hashtags?