SyncJournalFileRecord record;
- _journal.getFileRecord(relativePathBytes, &record);
+ if (!_journal.getFileRecord(relativePathBytes, &record)) {
+ qCWarning(lcFolder) << "could not get file from local DB" << relativePathBytes;
+ }
if (reason != ChangeReason::UnLock) {
// Check that the mtime/size actually changed or there was
// an attribute change (pin state) that caused the notification
// Set in the database that we should download the file
SyncJournalFileRecord record;
- _journal.getFileRecord(relativepath.toUtf8(), &record);
+ ;
+ if (!_journal.getFileRecord(relativepath.toUtf8(), &record)) {
+ qCWarning(lcFolder) << "could not get file from local DB" << relativepath;
+ return;
+ }
if (!record.isValid()) {
qCInfo(lcFolder) << "Did not find file in db";
return;
qCInfo(lcFolder) << "The file is not virtual";
return;
}
+
record._type = ItemTypeVirtualFileDownload;
- _journal.setFileRecord(record);
+
+ const auto result = _journal.setFileRecord(record);
+ if (!result) {
+ qCWarning(lcFolder) << "Error when setting the file record to the database" << record._path << result.error();
+ return;
+ }
// Change the file's pin state if it's contradictory to being hydrated
// (suffix-virtual file's pin state is stored at the hydrated path)
rec._checksumHeader = serverEntry.checksumHeader;
const auto result = _discoveryData->_statedb->setFileRecord(rec);
if (!result) {
- qCWarning(lcDisco) << "Error when setting the file record to the database" << result.error();
+ qCWarning(lcDisco) << "Error when setting the file record to the database" << rec._path << result.error();
}
}
return;
void EncryptFolderJob::slotEncryptionFlagSuccess(const QByteArray &fileId)
{
SyncJournalFileRecord rec;
- _journal->getFileRecord(_path, &rec);
- if (rec.isValid()) {
- rec._isE2eEncrypted = true;
- _journal->setFileRecord(rec);
+ if (!_journal->getFileRecord(_path, &rec)) {
+ qCWarning(lcEncryptFolderJob) << "could not get file from local DB" << _path;
+ }
+
+ if (!rec.isValid()) {
+ qCWarning(lcEncryptFolderJob) << "No valid record found in local DB for fileId" << fileId;
+ }
+
+ rec._isE2eEncrypted = true;
+ const auto result = _journal->setFileRecord(rec);
+ if (!result) {
+ qCWarning(lcEncryptFolderJob) << "Error when setting the file record to the database" << rec._path << result.error();
}
auto lockJob = new LockEncryptFolderApiJob(_account, fileId, this);
{
// Mark the file as hydrated in the sync journal
SyncJournalFileRecord record;
- _journal->getFileRecord(_folderPath, &record);
+ if (!_journal->getFileRecord(_folderPath, &record)) {
+ qCWarning(lcHydration) << "could not get file from local DB" << _folderPath;
+ return;
+ }
Q_ASSERT(record.isValid());
if (!record.isValid()) {
qCWarning(lcHydration) << "Couldn't find record to update after hydration" << _requestId << _folderPath;
// store the actual size of a file that has been decrypted as we will need its actual size when dehydrating it if requested
record._fileSize = FileSystem::getSize(localPath() + folderPath());
- _journal->setFileRecord(record);
+ const auto result = _journal->setFileRecord(record);
+ if (!result) {
+ qCWarning(lcHydration) << "Error when setting the file record to the database" << record._path << result.error();
+ }
}
void OCC::HydrationJob::onGetFinished()
// that are not marked as a virtual file. These could be real .owncloud
// files that were synced before vfs was enabled.
QByteArrayList toWipe;
- params.journal->getFilesBelowPath("", [&toWipe](const SyncJournalFileRecord &rec) {
+ if (!params.journal->getFilesBelowPath("", [&toWipe](const SyncJournalFileRecord &rec) {
if (!rec.isVirtualFile() && rec._path.endsWith(APPLICATION_DOTVIRTUALFILE_SUFFIX))
toWipe.append(rec._path);
- });
- for (const auto &path : toWipe)
- params.journal->deleteFileRecord(path);
+ })) {
+ qWarning() << "Could not get files below path \"\" from local DB";
+ }
+ for (const auto &path : toWipe) {
+ if (!params.journal->deleteFileRecord(path)) {
+ qWarning() << "Failed to delete file record from local DB" << path;
+ }
+ }
}
void VfsSuffix::stop()