fix(domains): preserve ports in split URL inputs (#11328)

This commit is contained in:
Andras Bacsai authored and GitHub committed 2026-08-17 16:05:21 +02:00
1 parent 5872cc095c
commit 282227b238
17 files changed
+182 -161

No files matched your search

+18
View File
@@ -5,6 +5,7 @@ namespace App\Livewire\Storage;
use App\Models\S3Storage;
use App\Rules\SafeWebhookUrl;
use App\Rules\ValidS3BucketName;
use App\Support\DomainUrlParts;
use App\Support\ValidationPatterns;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\DB;
@@ -24,6 +25,10 @@ class Form extends Component
public string $endpoint;
public array $endpointParts = ['scheme' => 'https', 'host' => '', 'port' => '', 'path' => ''];
public bool $endpointPartsChanged = false;
public string $bucket;
public string $region;
@@ -101,6 +106,8 @@ class Form extends Component
$this->name = $this->storage->name;
$this->description = $this->storage->description;
$this->endpoint = $this->storage->endpoint;
$this->endpointParts = DomainUrlParts::split($this->endpoint);
$this->endpointPartsChanged = false;
$this->bucket = $this->storage->bucket;
$this->region = $this->storage->region;
$this->key = $this->storage->key;
@@ -126,6 +133,9 @@ class Form extends Component
try {
$this->authorize('validateConnection', $this->storage);
if ($this->endpointPartsChanged) {
$this->endpoint = DomainUrlParts::compose(...$this->endpointParts);
}
$testedStorage = new S3Storage;
$testedStorage->uuid = $this->storage->uuid;
$testedStorage->team_id = $this->storage->team_id;
@@ -166,6 +176,9 @@ class Form extends Component
{
try {
$this->authorize('update', $this->storage);
if ($this->endpointPartsChanged) {
$this->endpoint = DomainUrlParts::compose(...$this->endpointParts);
}
DB::transaction(function () {
$this->validate();
@@ -195,4 +208,9 @@ class Form extends Component
return handleError($e, $this);
}
}
public function updatedEndpointParts(): void
{
$this->endpointPartsChanged = true;
}
}