fix: keep root output subfolders

This commit is contained in:
Benjamin Lu
2026-01-29 22:05:16 -08:00
parent 10fec20c7a
commit b32c9775e9
2 changed files with 31 additions and 1 deletions

View File

@@ -120,4 +120,34 @@ describe('resolveOutputAssetItems', () => {
'preview.png'
])
})
it('keeps root outputs with empty subfolders', async () => {
const output = createOutput({
filename: 'root.png',
nodeId: '1',
subfolder: '',
url: 'https://example.com/root.png'
})
const metadata: OutputAssetMetadata = {
promptId: 'prompt-root',
nodeId: '1',
subfolder: '',
outputCount: 1,
allOutputs: [output]
}
const results = await resolveOutputAssetItems(metadata)
expect(mocks.getJobDetail).not.toHaveBeenCalled()
expect(results).toHaveLength(1)
const [asset] = results
if (!asset) {
throw new Error('Expected a root output asset')
}
expect(asset.id).toBe('prompt-root-1--root.png')
if (!asset.user_metadata) {
throw new Error('Expected output metadata')
}
expect(asset.user_metadata.subfolder).toBe('')
})
})

View File

@@ -42,7 +42,7 @@ export function getOutputKey({
subfolder,
filename
}: OutputKeyParts): string | null {
if (nodeId == null || !subfolder || !filename) {
if (nodeId == null || subfolder == null || !filename) {
return null
}