CA证书包路径失效时退回系统证书库,修复附件上传 CONFIG_INVALID
- DifyRequiredAttachmentUpload:配置的 ca_file 不存在或不可读时记 warning 并改用系统证书库,仍校验对端证书与主机名 - DifyWorkflowRunStatus:同样处理,不再返回 RUN_STATUS_CONFIG_INVALID Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -284,7 +284,16 @@ final class DifyRequiredAttachmentUpload
|
||||
if (!array_key_exists('skip_missing', $options)) $options['skip_missing'] = true;
|
||||
if (!is_bool($options['skip_missing'])) self::fail('CONFIG_INVALID');
|
||||
$caFile = $options['ca_file'] ?? '';
|
||||
if (!is_string($caFile) || ($caFile !== '' && (!is_file($caFile) || !is_readable($caFile)))) self::fail('CONFIG_INVALID');
|
||||
if (!is_string($caFile)) self::fail('CONFIG_INVALID');
|
||||
if ($caFile !== '' && (!is_file($caFile) || !is_readable($caFile))) {
|
||||
// CA 证书包是可选项:路径失效(如 .env 沿用了其他机器的路径)时退回系统证书库,
|
||||
// 仍校验对端证书与主机名,不再让所有 AI 请求因此失败。
|
||||
if (class_exists(\think\facade\Log::class)) {
|
||||
try { \think\facade\Log::warning('dify attachment ca_file unreadable, using system CA store'); }
|
||||
catch (\Throwable $ignored) {}
|
||||
}
|
||||
$caFile = '';
|
||||
}
|
||||
$options['ca_file'] = $caFile;
|
||||
$options['resolved_hosts'] = self::resolvedHosts(array_key_exists('resolved_hosts', $options)
|
||||
? $options['resolved_hosts'] : []);
|
||||
|
||||
Reference in New Issue
Block a user