1 files changed, 6 insertions, 4 deletions
diff --git a/src/ui/MxcAnimatedImage.cpp b/src/ui/MxcAnimatedImage.cpp
index e58f2e6e..bd6a935d 100644
--- a/src/ui/MxcAnimatedImage.cpp
+++ b/src/ui/MxcAnimatedImage.cpp
@@ -53,10 +53,12 @@ MxcAnimatedImage::startDownload()
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;
}
|