Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(file): don't clean the filenames of avatar transfer
Browse files Browse the repository at this point in the history
also don't print the filenames to the log for privacy reasons
  • Loading branch information
sudden6 committed Jun 14, 2018
1 parent 3973102 commit 2a8ab03
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/core/corefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2a8ab03

Please sign in to comment.