Set permissions of saved attachments to be private to the current user (#6363)

This commit is contained in:
Stefan Sundin 2021-05-12 20:20:41 -07:00 committed by GitHub
parent 17326dc3ec
commit ee92b980bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -245,7 +245,8 @@ void EntryAttachmentsWidget::saveSelectedAttachments()
QFile file(attachmentPath);
const QByteArray attachmentData = m_entryAttachments->value(filename);
const bool saveOk = file.open(QIODevice::WriteOnly) && file.write(attachmentData) == attachmentData.size();
const bool saveOk = file.open(QIODevice::WriteOnly) && file.setPermissions(QFile::ReadUser | QFile::WriteUser)
&& file.write(attachmentData) == attachmentData.size();
if (!saveOk) {
errors.append(QString("%1 - %2").arg(filename, file.errorString()));
}