Skip to content

FILE 来源上传时,validateSourceAndSchedule 方法因缺少 Cron 表达式抛出异常 #20

Description

@SMHILYZYH

1.问题现象
在 KnowledgeDocumentServiceImpl 的 validateSourceAndSchedule 方法中,当上传来源为 FILE(本地文件),由于FILE类型的文件不会定时同步,所以一般不会有定时表达式,而该方法会强制校验 scheduleCron(定时表达式)是否为空。由于本地文件上传通常不需要配置 Cron 表达式,导致校验失败并抛出 ClientException("定时表达式不能为空")。

2.原因分析

  • 业务逻辑冲突:FILE 类型代表本地文件上传,数据源在客户端,不存在“远程定时拉取/同步”的场景。
  • 校验过度:当前的校验逻辑没有区分 SourceType。只要 isScheduleEnabled 返回 true,就强制要求 scheduleCron 不为空,这对于 FILE 类型是不合理的。

3.代码位置
KnowledgeDocumentServiceImpl类 -> validateSourceAndSchedule 方法

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions