From 310d9b894d1bd1ef3642c263d5e082f1f70a62ac Mon Sep 17 00:00:00 2001 From: d4x1 <1507509064@qq.com> Date: Thu, 8 May 2025 19:30:08 +0800 Subject: [PATCH] fix(framework): return empty project name when blueprint id is zero --- backend/server/services/pipeline.go | 3 +++ backend/server/services/pipeline_notification.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/server/services/pipeline.go b/backend/server/services/pipeline.go index 41e8d8c28ac..e5e187ac9ab 100644 --- a/backend/server/services/pipeline.go +++ b/backend/server/services/pipeline.go @@ -362,6 +362,9 @@ func getProjectName(pipeline *models.Pipeline) (string, errors.Error) { return "", errors.Default.New("pipeline is nil") } blueprintId := pipeline.BlueprintId + if blueprintId == 0 { + return "", nil + } dbBlueprint := &models.Blueprint{} err := db.First(dbBlueprint, dal.Where("id = ?", blueprintId)) if err != nil { diff --git a/backend/server/services/pipeline_notification.go b/backend/server/services/pipeline_notification.go index 2c25c44ce21..5370abc3400 100644 --- a/backend/server/services/pipeline_notification.go +++ b/backend/server/services/pipeline_notification.go @@ -23,7 +23,7 @@ import ( ) type PipelineNotificationParam struct { - ProjectName string + ProjectName string // can be an empty string, if pipeline is created and triggered by API PipelineID uint64 CreatedAt time.Time UpdatedAt time.Time