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:
@@ -41,10 +41,11 @@ final class DifyWorkflowRunStatus
|
||||
$upload = array_key_exists('required_attachment_upload', $config) ? $config['required_attachment_upload'] : [];
|
||||
$caFile = is_array($upload) ? (array_key_exists('ca_file', $upload) ? $upload['ca_file'] : '') : null;
|
||||
$root = is_string($baseUrl) ? self::apiRoot($baseUrl) : null;
|
||||
// 可选 CA 证书包路径失效时退回系统证书库(仍校验证书),与附件上传保持一致。
|
||||
if (is_string($caFile) && $caFile !== '' && (!@is_file($caFile) || !@is_readable($caFile))) $caFile = '';
|
||||
if ($root === null || !is_string($apiKey) || $apiKey === '' || strlen($apiKey) > 4096
|
||||
|| preg_match('/[^\x21-\x7e]/', $apiKey) !== 0
|
||||
|| !is_string($caFile) || preg_match('/[\x00-\x1f\x7f]/', $caFile) !== 0
|
||||
|| ($caFile !== '' && (!@is_file($caFile) || !@is_readable($caFile)))) {
|
||||
|| !is_string($caFile) || preg_match('/[\x00-\x1f\x7f]/', $caFile) !== 0) {
|
||||
return self::error('RUN_STATUS_CONFIG_INVALID');
|
||||
}
|
||||
unset($config, $models, $model, $upload, $baseUrl);
|
||||
|
||||
Reference in New Issue
Block a user