use the error message sent by the server for bulk upload
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 25 Nov 2021 21:58:12 +0000 (22:58 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 26 Nov 2021 15:32:08 +0000 (16:32 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/bulkpropagatorjob.cpp
src/libsync/bulkpropagatorjob.h

index ac66b41b3cb3f9d58f06c3342117754a73bbe0b0..06152026a66c776b973d2879c2acb0ccb634d771 100644 (file)
@@ -320,7 +320,7 @@ void BulkPropagatorJob::slotPutFinishedOneFile(const BulkUploadItem &singleFile,
     singleFile._item->_responseTimeStamp = job->responseTimestamp();
     singleFile._item->_requestId = job->requestId();
     if (singleFile._item->_httpErrorCode != 200) {
-        commonErrorHandling(singleFile._item);
+        commonErrorHandling(singleFile._item, fileReply[QStringLiteral("message")].toString());
         return;
     }
 
@@ -583,12 +583,13 @@ void BulkPropagatorJob::checkResettingErrors(SyncFileItemPtr item) const
     }
 }
 
-void BulkPropagatorJob::commonErrorHandling(SyncFileItemPtr item)
+void BulkPropagatorJob::commonErrorHandling(SyncFileItemPtr item,
+                                            const QString &errorMessage)
 {
     // Ensure errors that should eventually reset the chunked upload are tracked.
     checkResettingErrors(item);
 
-    abortWithError(item, SyncFileItem::NormalError, tr("Error"));
+    abortWithError(item, SyncFileItem::NormalError, errorMessage);
 }
 
 bool BulkPropagatorJob::checkFileStillExists(SyncFileItemPtr item,
index e4846f04102293cd471836c01658dcff46b1d1cd..0f7f1a36b9d87d65d7654fb274183b99d62e4ac2 100644 (file)
@@ -127,7 +127,8 @@ private:
     /**
      * Error handling functionality that is shared between jobs.
      */
-    void commonErrorHandling(SyncFileItemPtr item);
+    void commonErrorHandling(SyncFileItemPtr item,
+                             const QString &errorMessage);
 
     bool checkFileStillExists(SyncFileItemPtr item,
                               const bool finished,