From 2a8ab03e46dd08efc4051a01bea56fe6a4c38a11 Mon Sep 17 00:00:00 2001 From: sudden6 Date: Thu, 14 Jun 2018 22:35:27 +0200 Subject: [PATCH] fix(file): don't clean the filenames of avatar transfer also don't print the filenames to the log for privacy reasons --- src/core/corefile.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/core/corefile.cpp b/src/core/corefile.cpp index 768956b2f..17b56ff9e 100644 --- a/src/core/corefile.cpp +++ b/src/core/corefile.cpp @@ -289,7 +289,6 @@ void CoreFile::onFileReceiveCallback(Tox*, uint32_t friendId, uint32_t fileId, u { Core* core = static_cast(vCore); auto filename = ToxString(fname, fnameLen); - const auto cleanFileName = CoreFile::getCleanFileName(filename.getQString()); if (kind == TOX_FILE_KIND_AVATAR) { const ToxPk friendPk = core->getFriendPublicKey(friendId); @@ -323,17 +322,17 @@ void CoreFile::onFileReceiveCallback(Tox*, uint32_t friendId, uint32_t fileId, u } } } else { + const auto cleanFileName = CoreFile::getCleanFileName(filename.getQString()); + if (cleanFileName != filename.getQString()) { + qDebug() << QStringLiteral("Cleaned filename"); + filename = ToxString(cleanFileName); + emit core->fileNameChanged(); + } else { + qDebug() << QStringLiteral("filename already clean"); + } qDebug() << QString("Received file request %1:%2 kind %3").arg(friendId).arg(fileId).arg(kind); } - if (cleanFileName != filename.getQString()) { - qDebug() << QStringLiteral("Cleaned filename from %1 to %2").arg(filename.getQString()).arg(cleanFileName); - filename = ToxString(cleanFileName); - emit core->fileNameChanged(); - } else { - qDebug() << QStringLiteral("cleanFileName: filename already clean"); - } - ToxFile file{fileId, friendId, filename.getBytes(), "", ToxFile::RECEIVING}; file.filesize = filesize; file.fileKind = kind;