diff --git a/core/http/endpoints/localai/edit_model.go b/core/http/endpoints/localai/edit_model.go index c040ee1d6..919615098 100644 --- a/core/http/endpoints/localai/edit_model.go +++ b/core/http/endpoints/localai/edit_model.go @@ -158,7 +158,7 @@ func EditModelEndpoint(cl *config.ModelConfigLoader, appConfig *config.Applicati // Load the existing configuration configPath := filepath.Join(appConfig.SystemState.Model.ModelsPath, modelName+".yaml") - if err := utils.InTrustedRoot(configPath, appConfig.SystemState.Model.ModelsPath); err != nil { + if err := utils.VerifyPath(modelName+".yaml", appConfig.SystemState.Model.ModelsPath); err != nil { response := ModelResponse{ Success: false, Error: "Model configuration not trusted: " + err.Error(), diff --git a/core/http/endpoints/localai/import_model.go b/core/http/endpoints/localai/import_model.go index bdb84334d..c6ff6bb96 100644 --- a/core/http/endpoints/localai/import_model.go +++ b/core/http/endpoints/localai/import_model.go @@ -94,7 +94,7 @@ func ImportModelEndpoint(cl *config.ModelConfigLoader, appConfig *config.Applica // Create the configuration file configPath := filepath.Join(appConfig.SystemState.Model.ModelsPath, modelConfig.Name+".yaml") - if err := utils.InTrustedRoot(configPath, appConfig.SystemState.Model.ModelsPath); err != nil { + if err := utils.VerifyPath(modelConfig.Name+".yaml", appConfig.SystemState.Model.ModelsPath); err != nil { response := ModelResponse{ Success: false, Error: "Model path not trusted: " + err.Error(),