1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(file): don't clean the filenames of avatar transfer

also don't print the filenames to the log for privacy reasons
This commit is contained in:
sudden6 2018-06-14 22:35:27 +02:00
parent 3973102b6b
commit 2a8ab03e46
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -289,7 +289,6 @@ void CoreFile::onFileReceiveCallback(Tox*, uint32_t friendId, uint32_t fileId, u
{ {
Core* core = static_cast<Core*>(vCore); Core* core = static_cast<Core*>(vCore);
auto filename = ToxString(fname, fnameLen); auto filename = ToxString(fname, fnameLen);
const auto cleanFileName = CoreFile::getCleanFileName(filename.getQString());
if (kind == TOX_FILE_KIND_AVATAR) { if (kind == TOX_FILE_KIND_AVATAR) {
const ToxPk friendPk = core->getFriendPublicKey(friendId); const ToxPk friendPk = core->getFriendPublicKey(friendId);
@ -323,15 +322,15 @@ void CoreFile::onFileReceiveCallback(Tox*, uint32_t friendId, uint32_t fileId, u
} }
} }
} else { } else {
qDebug() << QString("Received file request %1:%2 kind %3").arg(friendId).arg(fileId).arg(kind); const auto cleanFileName = CoreFile::getCleanFileName(filename.getQString());
}
if (cleanFileName != filename.getQString()) { if (cleanFileName != filename.getQString()) {
qDebug() << QStringLiteral("Cleaned filename from %1 to %2").arg(filename.getQString()).arg(cleanFileName); qDebug() << QStringLiteral("Cleaned filename");
filename = ToxString(cleanFileName); filename = ToxString(cleanFileName);
emit core->fileNameChanged(); emit core->fileNameChanged();
} else { } else {
qDebug() << QStringLiteral("cleanFileName: filename already clean"); qDebug() << QStringLiteral("filename already clean");
}
qDebug() << QString("Received file request %1:%2 kind %3").arg(friendId).arg(fileId).arg(kind);
} }
ToxFile file{fileId, friendId, filename.getBytes(), "", ToxFile::RECEIVING}; ToxFile file{fileId, friendId, filename.getBytes(), "", ToxFile::RECEIVING};