Browse Source

fix(core): Don't apply Windows file transfer rename on other platforms

Filename cleaning was originally introduced for Windows
https://github.com/qTox/qTox/issues/1304. It's unneeded on other platforms, so
leave file names as they're sent there.

Fix #5242
reviewable/pr6482/r4
Anthony Bilinski 4 years ago
parent
commit
3180d23ee2
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 6
      src/core/corefile.cpp

6
src/core/corefile.cpp

@ -330,7 +330,7 @@ void CoreFile::onFileReceiveCallback(Tox* tox, uint32_t friendId, uint32_t fileI @@ -330,7 +330,7 @@ void CoreFile::onFileReceiveCallback(Tox* tox, uint32_t friendId, uint32_t fileI
tox_file_control(tox, friendId, fileId, TOX_FILE_CONTROL_CANCEL, nullptr);
emit core->friendAvatarRemoved(core->getFriendPublicKey(friendId));
return;
} else {
}
if (!ToxClientStandards::IsValidAvatarSize(filesize)) {
qWarning() <<
QString("Received avatar request from %1 with size %2.").arg(friendId).arg(filesize) +
@ -347,7 +347,7 @@ void CoreFile::onFileReceiveCallback(Tox* tox, uint32_t friendId, uint32_t fileI @@ -347,7 +347,7 @@ void CoreFile::onFileReceiveCallback(Tox* tox, uint32_t friendId, uint32_t fileI
emit core->fileAvatarOfferReceived(friendId, fileId, avatarBytes, filesize);
return;
}
} else {
#ifdef Q_OS_WIN
const auto cleanFileName = CoreFile::getCleanFileName(filename.getQString());
if (cleanFileName != filename.getQString()) {
qDebug() << QStringLiteral("Cleaned filename");
@ -356,8 +356,8 @@ void CoreFile::onFileReceiveCallback(Tox* tox, uint32_t friendId, uint32_t fileI @@ -356,8 +356,8 @@ void CoreFile::onFileReceiveCallback(Tox* tox, uint32_t friendId, uint32_t fileI
} else {
qDebug() << QStringLiteral("filename already clean");
}
#endif
qDebug() << QString("Received file request %1:%2 kind %3").arg(friendId).arg(fileId).arg(kind);
}
ToxFile file{fileId, friendId, filename.getBytes(), "", filesize, ToxFile::RECEIVING};
file.fileKind = kind;

Loading…
Cancel
Save