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

Forbid sending sequential files

They aren't seekable, and tend to be infinitely big..
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-08-28 19:06:51 +02:00
parent 34b8706408
commit af9c370169

View File

@ -29,6 +29,7 @@
#include <QMenu>
#include <QWidgetAction>
#include <QGridLayout>
#include <QMessageBox>
ChatForm::ChatForm(Friend* chatFriend)
: f(chatFriend), curRow{0}, lockSliderToBottom{true}
@ -286,6 +287,12 @@ void ChatForm::onAttachClicked()
QFile file(path);
if (!file.exists() || !file.open(QIODevice::ReadOnly))
return;
if (file.isSequential())
{
QMessageBox::critical(0, "Bad Idea", "You're trying to send a special (sequential) file, that's not going to work!");
return;
file.close();
}
long long filesize = file.size();
file.close();
QFileInfo fi(path);