From 7e8a8615b13c41c9003f1d9ad9f227ba8f2fd207 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 24 Nov 2023 18:38:00 +0100 Subject: [PATCH] Fix crash for forbidden non-mxc media BUG: 476698 --- src/models/messageeventmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/messageeventmodel.cpp b/src/models/messageeventmodel.cpp index 68d545275..bf04a9d20 100644 --- a/src/models/messageeventmodel.cpp +++ b/src/models/messageeventmodel.cpp @@ -944,12 +944,12 @@ QVariantMap MessageEventModel::getMediaInfoFromFileInfo(const EventContent::File QVariantMap mediaInfo; // Get the mxc URL for the media. - if (!fileInfo->url().isValid() || eventId.isEmpty()) { + if (!fileInfo->url().isValid() || fileInfo->url().scheme() != QStringLiteral("mxc") || eventId.isEmpty()) { mediaInfo["source"] = QUrl(); } else { QUrl source = m_currentRoom->makeMediaUrl(eventId, fileInfo->url()); - if (source.isValid() && source.scheme() == QStringLiteral("mxc")) { + if (source.isValid()) { mediaInfo["source"] = source; } else { mediaInfo["source"] = QUrl();