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:
Towsty
2026-10-12 12:21:20 -05:00
co-authored by Cursor
parent 7dcac5444c
commit 1bab5152f6
7 changed files with 169 additions and 46 deletions
+18 -6
View File
@@ -336,19 +336,31 @@ async function unlock() {
}
async function ingest(file: File) {
if (/last[\s._-]*frame/i.test(file.name || '')) return
if (/last[\s._-]*frame/i.test(file.name || '')) {
emit('error', 'Rejected as video handoff: filename matches last-frame. Choose a regular source image.')
return
}
const body = new FormData()
body.append('image', file)
body.append('folderId', current.value?.id || activeFolderId.value)
body.append('hideInput', String(props.hideInputPreview === true))
try {
const result = await $fetch<{ still?: { id: string; filename: string; hideInput?: boolean } }>('/api/library/stills', { method: 'POST', body })
emit('updated', result)
if (props.stillOnly) {
if (result.still?.id) emit('pick', result.still)
const result = await $fetch<{ still?: { id: string; filename: string; hideInput?: boolean }; stills?: PickerStill[] }>('/api/library/stills', { method: 'POST', body })
if (!result.still?.id) {
emit('error', 'Could not save that image to the library.')
return
}
emit('select', file, props.hideInputPreview === true, result.still?.id)
// Keep the new still in the payload the parent merges into library.stills
const stills = Array.isArray(result.stills) ? result.stills : []
if (!stills.some(item => item.id === result.still!.id)) {
stills.unshift(result.still as PickerStill)
}
emit('updated', { ...result, still: result.still, stills })
if (props.stillOnly) {
emit('pick', result.still)
return
}
emit('select', file, props.hideInputPreview === true, result.still.id)
} catch (error: any) {
emit('error', error?.data?.statusMessage || 'Could not save image')
}