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:
parent
3973102b6b
commit
2a8ab03e46
|
@ -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,17 +322,17 @@ void CoreFile::onFileReceiveCallback(Tox*, uint32_t friendId, uint32_t fileId, u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
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};
|
ToxFile file{fileId, friendId, filename.getBytes(), "", ToxFile::RECEIVING};
|
||||||
file.filesize = filesize;
|
file.filesize = filesize;
|
||||||
file.fileKind = kind;
|
file.fileKind = kind;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user