Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2020-12-17 16:03:01 +0300
committerHannah von Reth <vonreth@kde.org>2020-12-17 17:30:54 +0300
commitf3ac560211989daabed45c4a35f81b89973fe5c4 (patch)
tree7d86f64764d7ca118271fdad5b3117e7b95e9bef
parentf4420e707006a790836edae67939a0c73c4672ea (diff)
Handle errors in convertToPlaceholder
-rw-r--r--src/common/vfs.h4
-rw-r--r--src/libsync/owncloudpropagator.cpp4
-rw-r--r--src/libsync/propagatedownload.cpp6
-rw-r--r--src/libsync/syncengine.cpp7
-rw-r--r--src/libsync/vfs/suffix/vfs_suffix.cpp3
-rw-r--r--src/libsync/vfs/suffix/vfs_suffix.h2
6 files changed, 19 insertions, 7 deletions
diff --git a/src/common/vfs.h b/src/common/vfs.h
index 8bccb1eeb..7cb5604e9 100644
--- a/src/common/vfs.h
+++ b/src/common/vfs.h
@@ -186,7 +186,7 @@ public:
* new placeholder shall supersede, for rename-replace actions with new downloads,
* for example.
*/
- virtual void convertToPlaceholder(
+ virtual Result<void, QString> convertToPlaceholder(
const QString &filename,
const SyncFileItem &item,
const QString &replacesFile = QString()) = 0;
@@ -292,7 +292,7 @@ public:
Result<void, QString> updateMetadata(const QString &, time_t, qint64, const QByteArray &) override { return {}; }
Result<void, QString> createPlaceholder(const SyncFileItem &) override { return {}; }
Result<void, QString> dehydratePlaceholder(const SyncFileItem &) override { return {}; }
- void convertToPlaceholder(const QString &, const SyncFileItem &, const QString &) override {}
+ Result<void, QString> convertToPlaceholder(const QString &, const SyncFileItem &, const QString &) override { return {}; }
bool needsMetadataUpdate(const SyncFileItem &) override { return false; }
bool isDehydratedPlaceholder(const QString &) override { return false; }
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index 1c53a43cd..c7877efaf 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -751,7 +751,9 @@ QString OwncloudPropagator::adjustRenamedPath(const QString &original) const
bool OwncloudPropagator::updateMetadata(const SyncFileItem &item, const QString &localFolderPath, SyncJournalDb &journal, Vfs &vfs)
{
QString fsPath = localFolderPath + item.destination();
- vfs.convertToPlaceholder(fsPath, item);
+ if (!vfs.convertToPlaceholder(fsPath, item)) {
+ return false;
+ }
auto record = item.toSyncJournalFileRecordWithInode(fsPath);
return journal.setFileRecord(record);
}
diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index 9bd536c01..c75426e02 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -901,7 +901,11 @@ void PropagateDownloadFile::downloadFinished()
preserveGroupOwnership(_tmpFile.fileName(), existingFile);
// Make the file a hydrated placeholder if possible
- propagator()->syncOptions()._vfs->convertToPlaceholder(_tmpFile.fileName(), *_item, fn);
+ const auto result = propagator()->syncOptions()._vfs->convertToPlaceholder(_tmpFile.fileName(), *_item, fn);
+ if (!result) {
+ done(SyncFileItem::NormalError, result.error());
+ return;
+ }
}
// Apply the remote permissions
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 3ec0ab722..3b331ed1f 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -340,7 +340,12 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
// Ensure it's a placeholder file on disk
if (item->_type == ItemTypeFile) {
- _syncOptions._vfs->convertToPlaceholder(filePath, *item);
+ const auto result = _syncOptions._vfs->convertToPlaceholder(filePath, *item);
+ if (!result) {
+ item->_instruction = CSYNC_INSTRUCTION_ERROR;
+ item->_errorString = tr("Could not update file : %1").arg(result.error());
+ return;
+ }
}
// Update on-disk virtual file metadata
diff --git a/src/libsync/vfs/suffix/vfs_suffix.cpp b/src/libsync/vfs/suffix/vfs_suffix.cpp
index 0e66a6df9..56be2bd19 100644
--- a/src/libsync/vfs/suffix/vfs_suffix.cpp
+++ b/src/libsync/vfs/suffix/vfs_suffix.cpp
@@ -124,9 +124,10 @@ Result<void, QString> VfsSuffix::dehydratePlaceholder(const SyncFileItem &item)
return {};
}
-void VfsSuffix::convertToPlaceholder(const QString &, const SyncFileItem &, const QString &)
+Result<void, QString> VfsSuffix::convertToPlaceholder(const QString &, const SyncFileItem &, const QString &)
{
// Nothing necessary
+ return {};
}
bool VfsSuffix::isDehydratedPlaceholder(const QString &filePath)
diff --git a/src/libsync/vfs/suffix/vfs_suffix.h b/src/libsync/vfs/suffix/vfs_suffix.h
index 1144ad610..0ece74232 100644
--- a/src/libsync/vfs/suffix/vfs_suffix.h
+++ b/src/libsync/vfs/suffix/vfs_suffix.h
@@ -42,7 +42,7 @@ public:
Result<void, QString> createPlaceholder(const SyncFileItem &item) override;
Result<void, QString> dehydratePlaceholder(const SyncFileItem &item) override;
- void convertToPlaceholder(const QString &filename, const SyncFileItem &item, const QString &) override;
+ Result<void, QString> convertToPlaceholder(const QString &filename, const SyncFileItem &item, const QString &) override;
bool needsMetadataUpdate(const SyncFileItem &) override { return false; }
bool isDehydratedPlaceholder(const QString &filePath) override;