fix(s3): support virtual-hosted-style URLs for S3 storages

Add a "Use path-style URLs" setting to S3 storages. It is detected from
the endpoint (Alibaba OSS, Tencent COS, Volcengine/BytePlus TOS), and the
connection test switches to virtual-hosted style when the provider
rejects path-style requests. Backups pass `--path off` to mc.

Closes #10347
This commit is contained in:
Andras Bacsai
2026-10-27 15:53:16 +01:00
parent 56af27d46f
commit 1039368491
23 changed files with 396 additions and 19 deletions
@@ -1,6 +1,7 @@
<?php
use App\Livewire\Storage\Create;
use Livewire\Livewire;
it('formats the internal target settings route as a clickable link', function () {
$settingsUrl = route('settings.advanced').'#endpoint-section';
@@ -14,3 +15,18 @@ it('formats the internal target settings route as a clickable link', function ()
->toContain('Set them here.')
->not->toContain('targets: '.$settingsUrl);
});
it('turns path-style URLs off when the endpoint belongs to a provider that rejects them', function () {
Livewire::test(Create::class)
->set('endpointParts.host', 's3.oss-ap-southeast-1.aliyuncs.com')
->assertSet('usePathStyleEndpoint', false)
->set('endpointParts.host', 'minio.internal')
->assertSet('usePathStyleEndpoint', true);
});
it('keeps the URL style that the user selected when the endpoint changes', function () {
Livewire::test(Create::class)
->set('usePathStyleEndpoint', true)
->set('endpointParts.host', 's3.oss-ap-southeast-1.aliyuncs.com')
->assertSet('usePathStyleEndpoint', true);
});