Fix image edit disk upload so stills persist before Generate.
Reject only real handoff frames, return 400 with reason, keep the new still in the client library, and surface missing-still errors from Generate instead of 500s. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,12 +21,23 @@ export default defineEventHandler(async (event) => {
|
||||
if (!video && request.engine !== 'qwen21')
|
||||
assertImageV2LoraStack(request.settings.loraStack, request.engine);
|
||||
assertFolderAccess(event, request.folderId);
|
||||
for (const id of [request.identityStillId, request.imageAId, request.imageBId, request.maskId, request.endStillId, ...request.guides.map((g: any) => g.stillId)].filter(Boolean))
|
||||
assertFolderAccess(event, getStill(owner, id).folderId);
|
||||
if (request.startClipId)
|
||||
assertFolderAccess(event, getClip(owner, request.startClipId).folderId);
|
||||
// Header-only size probe — never decode the archive PNG on Generate click
|
||||
await resolveRequestSize(owner,request);
|
||||
try {
|
||||
for (const id of [request.identityStillId, request.imageAId, request.imageBId, request.maskId, request.endStillId, ...request.guides.map((g: any) => g.stillId)].filter(Boolean))
|
||||
assertFolderAccess(event, getStill(owner, id).folderId);
|
||||
if (request.startClipId)
|
||||
assertFolderAccess(event, getClip(owner, request.startClipId).folderId);
|
||||
// Header-only size probe — never decode the archive PNG on Generate click
|
||||
await resolveRequestSize(owner, request);
|
||||
} catch (e: any) {
|
||||
const message = e?.statusMessage || e?.message || 'Image not found'
|
||||
const missing = /not found|missing from the library|ENOENT|no such file/i.test(String(message))
|
||||
throw createError({
|
||||
statusCode: e?.statusCode || (missing ? 404 : 400),
|
||||
statusMessage: missing
|
||||
? (/missing from the library/i.test(String(message)) ? 'That still is missing from the library' : 'Image not found')
|
||||
: message
|
||||
})
|
||||
}
|
||||
const id = crypto.randomUUID(), record = { id, owner, request, state: 'waiting', queuedAt: Date.now(), familyId: crypto.randomUUID(), outputs: [], purgeResult: 'Not yet saved' };
|
||||
saveRecord(record);
|
||||
const ack = { id, seed:request.settings.seed, width:request.settings.width, height:request.settings.height };
|
||||
|
||||
Reference in New Issue
Block a user