mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-28 02:06:37 -04:00
fix: avoid inherited compose ports and defer archive inspection
Prevent multi-service Compose domains from inheriting the application port, and defer PostgreSQL custom-format archive inspection to pg_restore.
This commit is contained in:
@@ -569,6 +569,13 @@ class Domains extends Component
|
||||
];
|
||||
}
|
||||
|
||||
if ($this->isCompose && $service !== null && count($this->composeServices) > 1) {
|
||||
return [
|
||||
'internal_port' => null,
|
||||
'has_port_override' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$exposed = $this->application->ports_exposes_array;
|
||||
$defaultPort = isset($exposed[0]) && is_numeric($exposed[0]) && (int) $exposed[0] > 0
|
||||
? (int) $exposed[0]
|
||||
|
||||
@@ -537,6 +537,13 @@ class PreviewDomains extends Component
|
||||
];
|
||||
}
|
||||
|
||||
if ($this->preview->application->build_pack === 'dockercompose' && $service !== null && count($this->composeServices()) > 1) {
|
||||
return [
|
||||
'internal_port' => null,
|
||||
'has_port_override' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$exposed = $this->preview->application->ports_exposes_array;
|
||||
$defaultPort = isset($exposed[0]) && is_numeric($exposed[0]) && (int) $exposed[0] > 0
|
||||
? (int) $exposed[0]
|
||||
|
||||
@@ -90,11 +90,8 @@ class DatabaseBackupFileValidator
|
||||
|
||||
public static function containsPostgresqlProgramExecution(string $sql): bool
|
||||
{
|
||||
$requireStatementBoundary = true;
|
||||
|
||||
if (str_starts_with($sql, 'PGDMP')) {
|
||||
$sql = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]+/', "\n", $sql) ?? $sql;
|
||||
$requireStatementBoundary = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
$withoutComments = self::stripSqlComments($sql);
|
||||
@@ -103,9 +100,7 @@ class DatabaseBackupFileValidator
|
||||
return true;
|
||||
}
|
||||
|
||||
$copyPrefix = $requireStatementBoundary ? '(?:^|;)\s*' : '\b';
|
||||
|
||||
return preg_match('/'.$copyPrefix.'copy\b[^;]{0,2000}\b(?:from|to)\s+program\b/i', $withoutComments) === 1;
|
||||
return preg_match('/(?:^|;)\s*copy\b[^;]{0,2000}\b(?:from|to)\s+program\b/i', $withoutComments) === 1;
|
||||
}
|
||||
|
||||
private static function extensionFor(string $name): ?string
|
||||
|
||||
Reference in New Issue
Block a user