From 8a20cbd5c2f04ad661f3e771456ddfa8061d0b55 Mon Sep 17 00:00:00 2001 From: Sora39831 <540587985@qq.com> Date: Fri, 3 Apr 2026 09:29:53 +0800 Subject: [PATCH] feat: guard GetDb/ImportDB for MariaDB (unsupported SQLite-specific operations) --- web/service/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/service/server.go b/web/service/server.go index 3fec9e90..c0b7b74b 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -882,6 +882,9 @@ func (s *ServerService) GetConfigJson() (any, error) { } func (s *ServerService) GetDb() ([]byte, error) { + if config.GetDBTypeFromJSON() == "mariadb" { + return nil, common.NewError("Database export is not supported for MariaDB") + } // Update by manually trigger a checkpoint operation err := database.Checkpoint() if err != nil { @@ -904,6 +907,9 @@ func (s *ServerService) GetDb() ([]byte, error) { } func (s *ServerService) ImportDB(file multipart.File) error { + if config.GetDBTypeFromJSON() == "mariadb" { + return common.NewError("Database import is not supported for MariaDB") + } // Check if the file is a SQLite database isValidDb, err := database.IsSQLiteDB(file) if err != nil {