From 27683bedc41375ac97ddf87ce430fd98aac9fc7c Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 9 Oct 2024 02:19:35 +0200 Subject: Fix media deletion of animated files --- src/ui/MxcMediaProxy.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/ui/MxcMediaProxy.cpp') diff --git a/src/ui/MxcMediaProxy.cpp b/src/ui/MxcMediaProxy.cpp index 3773b141..275af9bf 100644 --- a/src/ui/MxcMediaProxy.cpp +++ b/src/ui/MxcMediaProxy.cpp @@ -96,10 +96,12 @@ MxcMediaProxy::startDownload(bool onlyCached) const auto url = mxcUrl.toStdString(); const auto name = QString(mxcUrl).remove(QStringLiteral("mxc://")); - QFileInfo filename( - QStringLiteral("%1/media_cache/media/%2.%3") - .arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation), name, suffix)); - if (QDir::cleanPath(name) != name) { + QFileInfo filename(QStringLiteral("%1/media_cache/media/%2.%3") + .arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation), + QString::fromUtf8(name.toUtf8().toBase64( + QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals)), + suffix)); + if (QDir::cleanPath(filename.filePath()) != filename.filePath()) { nhlog::net()->warn("mxcUrl '{}' is not safe, not downloading file", url); return; } -- cgit 1.5.1