修复图片编辑合并回归

补回快速编辑业务引用解析导入
确保非法主来源在生成目标预检前返回400
This commit is contained in:
2026-08-08 11:49:13 +08:00
parent 725930e9d3
commit 3c07a96a07
2 changed files with 19 additions and 10 deletions
@@ -4205,6 +4205,21 @@ fn ensure_editor_image_edit_source_reference_id_shape(
})))
}
fn ensure_editor_image_edit_source_reference_id_allowed(
source_reference_id: &str,
) -> Result<(), AppError> {
if source_reference_id.trim().is_empty() {
return Err(
AppError::from_status(StatusCode::BAD_REQUEST).with_details(json!({
"provider": "editor-image-edit",
"field": "sourceReferenceId",
"message": "sourceReferenceId 不能为空",
})),
);
}
ensure_editor_image_edit_source_reference_id_shape(source_reference_id)
}
fn map_editor_image_edit_lookup_error(
error: AppError,
field: &'static str,
@@ -4227,16 +4242,7 @@ async fn resolve_editor_image_edit_source(
payload: &EditorImageEditRequest,
) -> Result<EditorImageEditResolvedSource, AppError> {
let source_reference_id = payload.source_reference_id.trim();
if source_reference_id.is_empty() {
return Err(
AppError::from_status(StatusCode::BAD_REQUEST).with_details(json!({
"provider": "editor-image-edit",
"field": "sourceReferenceId",
"message": "sourceReferenceId 不能为空",
})),
);
}
ensure_editor_image_edit_source_reference_id_shape(source_reference_id)?;
ensure_editor_image_edit_source_reference_id_allowed(source_reference_id)?;
let oss_client = state.oss_client().ok_or_else(|| {
AppError::from_status(StatusCode::SERVICE_UNAVAILABLE).with_details(json!({
"provider": "aliyun-oss",
@@ -5545,6 +5551,7 @@ pub(crate) async fn enqueue_editor_image_edit_for_owner(
"referenceImageSrcs",
"修改参考图",
)?;
ensure_editor_image_edit_source_reference_id_allowed(&payload.source_reference_id)?;
let target = preflight_editor_billable_generation_target(
state,
caller.owner_user_id.as_str(),
@@ -5627,6 +5634,7 @@ pub(crate) async fn edit_editor_image_for_owner_with_source_snapshot(
"referenceImageSrcs",
"修改参考图",
)?;
ensure_editor_image_edit_source_reference_id_allowed(&payload.source_reference_id)?;
let target = preflight_editor_billable_generation_target(
state,
caller.owner_user_id.as_str(),
@@ -84,6 +84,7 @@ import {
buildImageGenerationSubmissionPlan,
resolveGenerationAssetLabel,
resolveImageGenerationDialogPrompt,
resolveRegisteredEditorReferenceId,
} from './ImageCanvasGenerationSubmissionModel';
import type {
UiAssetExtractionMark,