mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-18 01:20:31 +00:00
fix(git): trim whitespace from repository, branch, and commit SHA fields
- Add automatic trimming in Application model's boot method for git_repository, git_branch, and git_commit_sha fields
- Add real-time trimming in Source Livewire component via updated{Property} methods
- Refresh component state after save to ensure UI displays trimmed values
- Prevents deployment issues caused by accidental whitespace in git configuration
This commit is contained in:
@@ -47,6 +47,21 @@ class Source extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function updatedGitRepository()
|
||||
{
|
||||
$this->gitRepository = trim($this->gitRepository);
|
||||
}
|
||||
|
||||
public function updatedGitBranch()
|
||||
{
|
||||
$this->gitBranch = trim($this->gitBranch);
|
||||
}
|
||||
|
||||
public function updatedGitCommitSha()
|
||||
{
|
||||
$this->gitCommitSha = trim($this->gitCommitSha);
|
||||
}
|
||||
|
||||
public function syncData(bool $toModel = false)
|
||||
{
|
||||
if ($toModel) {
|
||||
@@ -57,6 +72,9 @@ class Source extends Component
|
||||
'git_commit_sha' => $this->gitCommitSha,
|
||||
'private_key_id' => $this->privateKeyId,
|
||||
]);
|
||||
// Refresh to get the trimmed values from the model
|
||||
$this->application->refresh();
|
||||
$this->syncData(false);
|
||||
} else {
|
||||
$this->gitRepository = $this->application->git_repository;
|
||||
$this->gitBranch = $this->application->git_branch;
|
||||
|
||||
Reference in New Issue
Block a user