summary refs log tree commit diff
path: root/src/ui/MxcMediaProxy.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-10-09 02:19:35 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2024-10-09 03:39:19 +0200
commit27683bedc41375ac97ddf87ce430fd98aac9fc7c (patch)
treebd6d81e520e00ac9f55e9c36097c667a9d3e5771 /src/ui/MxcMediaProxy.cpp
parentDisable http3 support by default and warn if users enable it (diff)
downloadnheko-27683bedc41375ac97ddf87ce430fd98aac9fc7c.tar.xz
Fix media deletion of animated files
Diffstat (limited to 'src/ui/MxcMediaProxy.cpp')
-rw-r--r--src/ui/MxcMediaProxy.cpp10
1 files changed, 6 insertions, 4 deletions
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; }