diff --git a/client/chatroomwidget.cpp b/client/chatroomwidget.cpp index 82c0377a..49f7f840 100644 --- a/client/chatroomwidget.cpp +++ b/client/chatroomwidget.cpp @@ -341,7 +341,8 @@ void ChatRoomWidget::dropFile(const QString& localPath) QString ChatRoomWidget::checkAttachment() { Q_ASSERT(m_fileToAttach != nullptr); - if (m_fileToAttach->open(QIODevice::ReadOnly)) + if (m_fileToAttach->isReadable() + || m_fileToAttach->open(QIODevice::ReadOnly)) return {}; // Form the message in advance while the file name is still there @@ -415,10 +416,6 @@ QString ChatRoomWidget::sendFile() if (const auto error = checkAttachment(); !error.isEmpty()) return error; - if (!m_fileToAttach->open(QIODevice::ReadOnly)) - return tr("%1 is not readable or not a file") - .arg(m_fileToAttach->fileName()); - QFileInfo fileInfo(*m_fileToAttach); currentRoom()->postFile(description.isEmpty() ? fileInfo.fileName() : description,