Merge pull request #59301 from nextcloud/backport/59270/stable32
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Integration sqlite / changes (push) Waiting to run
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, --tags ~@large files_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, capabilities_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, collaboration_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, comments_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, dav_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, federation_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, file_conversions) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, files_reminders) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, filesdrop_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, ldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, openldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, openldap_numerical_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, remoteapi_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, routing_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, setup_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, sharees_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, sharing_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, theming_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable32, 8.1, stable32, videoverification_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite-summary (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis (push) Has been cancelled
Psalm static code analysis / static-code-analysis-security (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ocp (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ncu (push) Has been cancelled

[stable32] fix(chunkedUploads): Ensure max parallel count is at least 1
This commit is contained in:
Git'Fellow 2026-04-11 09:58:26 +02:00 committed by GitHub
commit a99a8c4d5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 2 deletions

View file

@ -25,6 +25,6 @@ class ChunkedUploadConfig {
}
public static function getMaxParallelCount(): int {
return Server::get(IConfig::class)->getSystemValueInt(self::KEY_MAX_PARALLEL_COUNT, 5);
return max(1, Server::get(IConfig::class)->getSystemValueInt(self::KEY_MAX_PARALLEL_COUNT, 5));
}
}

View file

@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files\Tests\Service;
use OCA\Files\Service\ChunkedUploadConfig;
use OCP\IConfig;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ChunkedUploadConfigTest extends TestCase {
private IConfig&MockObject $config;
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->overwriteService(IConfig::class, $this->config);
}
protected function tearDown(): void {
$this->restoreAllServices();
parent::tearDown();
}
public static function dataGetMaxParallelCount(): array {
return [
'configured positive value' => [3, 3],
'boundary minimum' => [1, 1],
'zero becomes one' => [0, 1],
'negative becomes one' => [-2, 1],
'large value passes through' => [100, 100],
];
}
#[DataProvider('dataGetMaxParallelCount')]
public function testGetMaxParallelCount(int $configuredValue, int $expectedValue): void {
$this->config->expects($this->once())
->method('getSystemValueInt')
->with('files.chunked_upload.max_parallel_count', 5)
->willReturn($configuredValue);
$this->assertSame($expectedValue, ChunkedUploadConfig::getMaxParallelCount());
}
}

View file

@ -2798,7 +2798,7 @@ $CONFIG = [
/**
* Maximum number of chunks uploaded in parallel during chunked uploads. Higher
* counts increase throughput but consume more server resources, with diminishing
* returns.
* returns. Value must be a positive integer.
*
* Defaults to ``5``
*/