From 376881d9f95391789f18be1b6fcc64db7a7c7581 Mon Sep 17 00:00:00 2001 From: 134 Date: Mon, 6 Jul 2026 07:53:49 +0800 Subject: [PATCH] fix: upload source for product lock mask edit --- app/api/canvas/local-edit/route.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/api/canvas/local-edit/route.ts b/app/api/canvas/local-edit/route.ts index cdfc72c5d..2e0f3bda0 100644 --- a/app/api/canvas/local-edit/route.ts +++ b/app/api/canvas/local-edit/route.ts @@ -132,6 +132,7 @@ type ScaleAdjustPatchReference = { productLockOverlayUrl?: string | null; productLockProtectMaskUrl?: string | null; sourceCropUrl: string; + sourceFullUrl?: string | null; structureLockedDraft?: boolean; targetDraftFullUrl?: string | null; targetDraftUrl: string; @@ -3819,6 +3820,7 @@ async function createScaleAdjustPatchReference(params: { const suffix = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`; if (params.fullFrameReferenceOnly && structureLockAppliedRef.value) { const [ + sourceFullUpload, targetDraftFullUpload, backgroundPlateFullUpload, productLockOverlayUpload, @@ -3827,6 +3829,15 @@ async function createScaleAdjustPatchReference(params: { productLockEditMaskUpload, productLockFalEditMaskUpload, ] = await Promise.all([ + sharp(sourceBuffer, { failOn: "none" }) + .png({ compressionLevel: 6 }) + .toBuffer() + .then((sourceFullBuffer) => + uploadFile( + `canvas-scale-adjust-source-full-${suffix}.png`, + toArrayBuffer(sourceFullBuffer) + ) + ), uploadFile( `canvas-scale-adjust-full-target-draft-${suffix}.png`, toArrayBuffer(targetDraftBuffer) @@ -3878,6 +3889,7 @@ async function createScaleAdjustPatchReference(params: { productLockOverlayUrl: productLockOverlayUpload?.url || null, productLockProtectMaskUrl: productLockProtectMaskUpload?.url || null, sourceCropUrl: sourceImageUrl || targetDraftFullUpload.url, + sourceFullUrl: sourceFullUpload.url, structureLockedDraft: structureLockAppliedRef.value, targetDraftFullUrl: targetDraftFullUpload.url, targetDraftUrl: targetDraftFullUpload.url, @@ -5436,7 +5448,7 @@ export async function POST(request: NextRequest) { ? useScaleAdjustProductLockComposite ? useScaleAdjustProductLockMaskEdit ? [ - sourceImageUrl, + scaleAdjustPatchReference.sourceFullUrl || sourceImageUrl, ...scaleAdjustCropReferenceImageUrls, ...manualRegionReferenceImageUrls, ] @@ -5605,6 +5617,8 @@ export async function POST(request: NextRequest) { : null, scaleAdjustPatchSourceCropUrl: scaleAdjustPatchReference?.sourceCropUrl || null, + scaleAdjustPatchSourceFullUrl: + scaleAdjustPatchReference?.sourceFullUrl || null, scaleAdjustPatchTargetDraftUrl: scaleAdjustPatchReference?.targetDraftUrl || null, scaleAdjustPatchTargetDraftFullUrl: