v0.4.6: MariaDB validation fix + dashboard deployed-only + protected stack restart
- Fix ValidateDump() to scan first 10 lines for header (MariaDB 11.4+ sandbox comment) - Dashboard shows only deployed/protected stacks, heading "Telepített alkalmazások" - Protected stacks show restart button when operational (both dashboard + stacks page) - API blocks all actions except restart on protected stacks - docker-setup.sh creates .felhom.yml for FileBrowser (subdomain: files) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -264,18 +264,38 @@ func ValidateDump(filePath string, dbType DBType) DumpValidation {
|
||||
}
|
||||
v.TableCount = tableCount
|
||||
|
||||
// Basic header check
|
||||
switch dbType {
|
||||
case DBTypePostgres:
|
||||
if !strings.HasPrefix(content, "--") {
|
||||
v.Error = "PostgreSQL dump missing comment header"
|
||||
return v
|
||||
// Header check — scan first 10 lines for expected dump header
|
||||
// MariaDB 11.4+ prepends a sandbox comment before the header line
|
||||
headerFound := false
|
||||
lines := strings.SplitN(content, "\n", 11) // at most 11 parts = 10 lines
|
||||
for i, line := range lines {
|
||||
if i >= 10 {
|
||||
break
|
||||
}
|
||||
case DBTypeMariaDB:
|
||||
if !strings.HasPrefix(content, "-- ") {
|
||||
switch dbType {
|
||||
case DBTypeMariaDB:
|
||||
if strings.HasPrefix(line, "-- MariaDB dump") ||
|
||||
strings.HasPrefix(line, "-- MySQL dump") ||
|
||||
strings.HasPrefix(line, "-- mysqldump") {
|
||||
headerFound = true
|
||||
}
|
||||
case DBTypePostgres:
|
||||
if strings.HasPrefix(line, "-- PostgreSQL database dump") {
|
||||
headerFound = true
|
||||
}
|
||||
}
|
||||
if headerFound {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !headerFound {
|
||||
switch dbType {
|
||||
case DBTypeMariaDB:
|
||||
v.Error = "MariaDB dump missing comment header"
|
||||
return v
|
||||
case DBTypePostgres:
|
||||
v.Error = "PostgreSQL dump missing comment header"
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
if tableCount == 0 {
|
||||
|
||||
Reference in New Issue
Block a user