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);
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;