Add chunked uploads and raise storage rate to GHS 0.30/GB/month.
Deploy Ladill Transfer / deploy (push) Successful in 39s

Large files upload in 5 MB chunks (hosting file manager pattern) for the
transfer UI and Ladill Mail S2S API, with no app-level file size cap when
TRANSFER_MAX_FILE_BYTES=0.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-08 12:07:27 +00:00
co-authored by Cursor
parent fb131cd7fa
commit 65b634bb0b
23 changed files with 797 additions and 27 deletions
+44
View File
@@ -59,4 +59,48 @@ class TransferApiTest extends TestCase
$this->post('/api/v1/transfers', ['mailbox' => 'x@y.com'])
->assertUnauthorized();
}
public function test_webmail_service_can_finalize_chunked_upload(): void
{
Http::fake([
rtrim((string) config('identity.api_url'), '/').'/identity/profile*' => Http::response([
'data' => [
'public_id' => (string) Str::uuid(),
'name' => 'Mail User',
'email' => 'chunked@acme.com',
'picture' => null,
],
]),
]);
$init = $this->withToken('test-webmail-key')->postJson('/api/v1/transfers/upload/init', [
'mailbox' => 'chunked@acme.com',
'filename' => 'archive.zip',
'filesize' => 12,
])->assertOk()->json();
$uploadId = (string) ($init['upload_id'] ?? '');
$this->assertNotSame('', $uploadId);
$chunk = UploadedFile::fake()->createWithContent('chunk_0', str_repeat('a', 12));
$this->withToken('test-webmail-key')->post('/api/v1/transfers/upload/chunk', [
'mailbox' => 'chunked@acme.com',
'upload_id' => $uploadId,
'chunk_index' => 0,
'chunk_size' => 12,
'chunk' => $chunk,
])->assertOk();
$this->withToken('test-webmail-key')->postJson('/api/v1/transfers/upload/finalize', [
'mailbox' => 'chunked@acme.com',
'upload_id' => $uploadId,
'total_chunks' => 1,
'title' => 'Email: Big file',
])
->assertCreated()
->assertJsonPath('data.title', 'Email: Big file')
->assertJsonStructure(['data' => ['public_url', 'files']]);
$this->assertDatabaseCount('transfers', 1);
}
}