Merge pull request #8141 from nextcloud/backport/8140/stable-3.16

[stable-3.16] disable use of bulk upload for small files
This commit is contained in:
Matthieu Gallien 2025-04-10 17:13:54 +02:00 committed by GitHub
commit d1a591ae31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 22 deletions

View File

@ -1091,29 +1091,9 @@ Result<Vfs::ConvertToPlaceholderResult, QString> OwncloudPropagator::staticUpdat
bool OwncloudPropagator::isDelayedUploadItem(const SyncFileItemPtr &item) const
{
const auto checkFileShouldBeEncrypted = [this] (const SyncFileItemPtr &item) -> bool {
const auto path = item->_file;
const auto slashPosition = path.lastIndexOf('/');
const auto parentPath = slashPosition >= 0 ? path.left(slashPosition) : QString();
Q_UNUSED(item)
SyncJournalFileRecord parentRec;
bool ok = _journal->getFileRecord(parentPath, &parentRec);
if (!ok) {
return false;
}
const auto accountPtr = account();
if (!parentRec.isValid() ||
!parentRec.isE2eEncrypted()) {
return false;
}
return true;
};
return account()->capabilities().bulkUpload() && !_scheduleDelayedTasks && !item->isEncrypted() && _syncOptions.minChunkSize() > item->_size
&& !isInBulkUploadBlackList(item->_file) && !checkFileShouldBeEncrypted(item);
return false;
}
void OwncloudPropagator::setScheduleDelayedTasks(bool active)

View File

@ -150,6 +150,8 @@ private slots:
}
void testDirUploadWithDelayedAlgorithm() {
QSKIP("bulk upload is disabled");
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
fakeFolder.syncEngine().account()->setCapabilities({ { "dav", QVariantMap{ {"bulkupload", "1.0"} } } });
@ -181,6 +183,8 @@ private slots:
}
void testDirUploadWithDelayedAlgorithmWithNewChecksum() {
QSKIP("bulk upload is disabled");
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
fakeFolder.setServerVersion(QStringLiteral("32.0.0"));
fakeFolder.syncEngine().account()->setCapabilities({ { "dav", QVariantMap{ {"bulkupload", "1.0"} } } });
@ -1009,6 +1013,8 @@ private slots:
*/
void testErrorsWithBulkUpload()
{
QSKIP("bulk upload is disabled");
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
fakeFolder.syncEngine().account()->setCapabilities({ { "dav", QVariantMap{ {"bulkupload", "1.0"} } } });
@ -1104,6 +1110,8 @@ private slots:
*/
void testNetworkErrorsWithBulkUpload()
{
QSKIP("bulk upload is disabled");
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
fakeFolder.syncEngine().account()->setCapabilities({ { "dav", QVariantMap{ {"bulkupload", "1.0"} } } });
@ -1152,6 +1160,8 @@ private slots:
void testNetworkErrorsWithSmallerBatchSizes()
{
QSKIP("bulk upload is disabled");
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
fakeFolder.syncEngine().account()->setCapabilities({ { "dav", QVariantMap{ {"bulkupload", "1.0"} } } });
@ -1477,6 +1487,8 @@ private slots:
void testLocalInvalidMtimeCorrectionBulkUpload()
{
QSKIP("bulk upload is disabled");
const auto INVALID_MTIME = QDateTime::fromSecsSinceEpoch(0);
const auto RECENT_MTIME = QDateTime::fromSecsSinceEpoch(1743004783); // 2025-03-26T16:59:43+0100