Skip to content

Commit c5e42f1

Browse files
xbingWdhsifss
andauthored
fix: skip set file_type when file_type unknown (#249)
Co-authored-by: 姚凯 <kai.yao@chaitin.com>
1 parent d33913e commit c5e42f1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

backend/sub/anydoc_task.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,17 @@ func (t *anydocTask) Handle(ctx context.Context, msg mq.Message) error {
132132
taskInfo.Err = taskInfo.Err[:200]
133133
}
134134

135-
err = t.repoDoc.Update(ctx, map[string]any{
135+
updateM := map[string]any{
136136
"status": model.DocStatusExportFailed,
137137
"message": taskInfo.Err,
138138
"platform_opt": model.NewJSONB(taskInfo.PlatformOpt),
139-
"file_type": taskInfo.DocType,
140-
}, repo.QueryWithEqual("id", dbDoc.ID))
139+
}
140+
141+
if taskInfo.DocType != model.FileTypeUnknown {
142+
updateM["file_type"] = taskInfo.DocType
143+
}
144+
145+
err = t.repoDoc.Update(ctx, updateM, repo.QueryWithEqual("id", dbDoc.ID))
141146
if err != nil {
142147
logger.WithErr(err).With("doc_id", dbDoc.ID).Warn("create kb_document failed")
143148
return err

0 commit comments

Comments
 (0)