Raise default ZIP file limit for imports to 10000

Toggl exports contain two files per project, so the previous limit of 100 rejected workspaces with more than about 40 projects.
This commit is contained in:
Constantin Graf
2026-10-14 10:30:53 +02:00
committed by Constantin Graf
parent b9e3f55537
commit 9a845bad8f
2 changed files with 25 additions and 1 deletions

View File

@@ -27,7 +27,7 @@ return [
|
*/
'zip_max_files' => (int) (env('IMPORT_ZIP_MAX_FILES') ?: 100),
'zip_max_files' => (int) (env('IMPORT_ZIP_MAX_FILES') ?: 10000),
'zip_max_uncompressed_size' => (int) (env('IMPORT_ZIP_MAX_UNCOMPRESSED_SIZE') ?: 500 * 1024 * 1024),

View File

@@ -88,6 +88,30 @@ class ZipImportHelperTest extends TestCase
$this->fail();
}
public function test_extract_with_default_limit_allows_toggl_export_with_many_projects(): void
{
// Arrange
// Toggl exports contain one projects_users and one tasks file per project
$files = [
'clients.json' => '[]',
'projects.json' => '[]',
'tags.json' => '[]',
'workspace_users.json' => '[]',
];
for ($project = 1; $project <= 2000; $project++) {
$files['projects_users/'.$project.'.json'] = '[]';
$files['tasks/'.$project.'.json'] = '[]';
}
$zipPath = $this->createZip($files);
// Act
app(ZipImportHelper::class)->extract($zipPath, $this->targetDirectory->path());
// Assert
$this->assertSame('[]', file_get_contents($this->targetDirectory->path('projects_users/2000.json')));
$this->assertSame('[]', file_get_contents($this->targetDirectory->path('tasks/2000.json')));
}
public function test_extract_throws_exception_if_zip_contains_too_many_files(): void
{
// Arrange