Let saved library stills queue Edit without a format rejection.
Use catalog width/height or aspect fallback in resolveRequestSize, restore GIF/BMP upload messaging, and keep Photo to change still ids across reload so Klein/Qwen Edit can bind imageAId. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,18 +32,20 @@ export async function resolveRequestSize(owner: string, request: any) {
|
||||
const id = request.imageAId || request.identityStillId
|
||||
if (id) {
|
||||
const still = getStill(owner, id)
|
||||
const path = stillPath(owner, id)
|
||||
if (!existsSync(path)) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'That still is missing from the library' })
|
||||
}
|
||||
if (still.width && still.height) {
|
||||
dimensions = { width: still.width, height: still.height }
|
||||
// Catalog size wins — never re-probe a saved still as an upload format check.
|
||||
if (Number(still.width) > 0 && Number(still.height) > 0) {
|
||||
dimensions = { width: Number(still.width), height: Number(still.height) }
|
||||
} else {
|
||||
// Header only — never read the full archive PNG into memory on Generate click
|
||||
dimensions = imageDimensions(readImageHeader(path))
|
||||
}
|
||||
if (!dimensions) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Use a PNG, JPEG, or WebP' })
|
||||
const path = stillPath(owner, id)
|
||||
if (!existsSync(path)) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'That still is missing from the library' })
|
||||
}
|
||||
try {
|
||||
dimensions = imageDimensions(readImageHeader(path))
|
||||
} catch {
|
||||
dimensions = null
|
||||
}
|
||||
// Header probe failed — fall through to bench aspect via resolveSize.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user