Merge pull request #624 from Cadair/inline_img_single_quote

Add another regex to match inline img tags using single quotes
This commit is contained in:
DeepBlueV7.X 2021-06-25 17:27:15 +00:00 committed by GitHub
commit fddc558b23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -532,6 +532,10 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
const static QRegularExpression matchImgUri( const static QRegularExpression matchImgUri(
"(<img [^>]*)src=\"mxc://([^\"]*)\"([^>]*>)"); "(<img [^>]*)src=\"mxc://([^\"]*)\"([^>]*>)");
formattedBody_.replace(matchImgUri, "\\1 src=\"image://mxcImage/\\2\"\\3"); formattedBody_.replace(matchImgUri, "\\1 src=\"image://mxcImage/\\2\"\\3");
// Same regex but for single quotes around the src
const static QRegularExpression matchImgUri2(
"(<img [^>]*)src=\'mxc://([^\']*)\'([^>]*>)");
formattedBody_.replace(matchImgUri2, "\\1 src=\"image://mxcImage/\\2\"\\3");
const static QRegularExpression matchEmoticonHeight( const static QRegularExpression matchEmoticonHeight(
"(<img data-mx-emoticon [^>]*)height=\"([^\"]*)\"([^>]*>)"); "(<img data-mx-emoticon [^>]*)height=\"([^\"]*)\"([^>]*>)");
formattedBody_.replace(matchEmoticonHeight, formattedBody_.replace(matchEmoticonHeight,