fix(ui): normalize S3 endpoints and remove duplicate config warnings

Normalize endpoints on blur and submit, link internal-target errors to settings, and target the S3 submit loading state.
This commit is contained in:
Andras Bacsai
2026-08-14 18:48:34 +02:00
parent a257224bb7
commit b3789d4a36
9 changed files with 127 additions and 31 deletions
@@ -0,0 +1,29 @@
<?php
use App\Livewire\Storage\Create;
use Tests\TestCase;
uses(TestCase::class);
it('normalizes S3 endpoints without a Livewire blur request', function () {
$view = file_get_contents(resource_path('views/livewire/storage/create.blade.php'));
expect($view)
->not->toContain('wire:model.blur="endpoint"')
->toContain('x-on:blur')
->toContain('const hasScheme')
->toContain('dispatchEvent');
});
it('normalizes endpoints again on the backend', function (string $endpoint, string $expected) {
$method = new ReflectionMethod(Create::class, 'normalizeEndpoint');
expect($method->invoke(new Create, $endpoint))->toBe($expected);
})->with([
'missing scheme' => ['s3.example.com', 'https://s3.example.com'],
'existing HTTP scheme' => ['http://192.168.1.50:9000', 'http://192.168.1.50:9000'],
'malformed HTTP scheme' => ['http:/192.168.1.50:9000', 'http:/192.168.1.50:9000'],
'hostname with port' => ['minio.internal:9000', 'https://minio.internal:9000'],
'unsupported scheme' => ['ftp://s3.example.com', 'ftp://s3.example.com'],
'DigitalOcean bucket endpoint' => ['https://bucket.nyc3.digitaloceanspaces.com', 'https://nyc3.digitaloceanspaces.com'],
]);