Prerequisites
What happened?
Broken Thumbnails for Subfolder-Prefixed Image Combo Values in WidgetSelectDropdown
Description
The getMediaUrl() function in WidgetSelectDropdown.vue passes the raw combo widget value as a single filename query parameter to /api/view. When a combo value contains a subfolder path (e.g. ipadapter/Alyson/image.png), the resulting URL is:
/api/view?filename=ipadapter%2FAlyson%2Fimage.png&type=input
The /api/view handler in server.py (line 541) calls os.path.basename(filename), which strips the subfolder portion, then looks for image.png directly in the root input directory. The file isn't there — it's in input/ipadapter/Alyson/ — so the request returns 404 and the thumbnail is broken.
Root Cause
getMediaUrl() at WidgetSelectDropdown.vue:519-528:
function getMediaUrl(
filename: string,
type: 'input' | 'output' = 'input'
): string {
if (!['image', 'video', 'audio', 'mesh'].includes(props.assetKind ?? ''))
return ''
const params = new URLSearchParams({ filename, type })
appendCloudResParam(params, filename)
return `/api/view?${params}`
}
The function does not split the subfolder prefix out of filename. The /api/view endpoint already supports a separate subfolder query parameter (server.py:535-539), and the codebase already has a utility that performs the correct split — parseImageWidgetValue() in src/utils/imageUtil.ts.
Other parts of the codebase handle this correctly. For example, ResultItemImpl.urlParams in queueStore.ts passes filename and subfolder as separate parameters.
Suggested Fix
Use parseImageWidgetValue() to split the value before building the URL:
import { parseImageWidgetValue } from '@/utils/imageUtil'
function getMediaUrl(
filename: string,
type: 'input' | 'output' = 'input'
): string {
if (!['image', 'video', 'audio', 'mesh'].includes(props.assetKind ?? ''))
return ''
const parsed = parseImageWidgetValue(filename)
const params = new URLSearchParams({
filename: parsed.filename,
type: parsed.type !== 'input' ? parsed.type : type
})
if (parsed.subfolder) params.set('subfolder', parsed.subfolder)
appendCloudResParam(params, filename)
return `/api/view?${params}`
}
Expected Behavior
Thumbnails should load correctly for combo values containing subfolder paths. The URL should be constructed as:
/api/view?filename=image.png&subfolder=ipadapter%2FAlyson&type=input
Environment
- ComfyUI Frontend with Nodes 2.0 renderer enabled
- Any custom node providing subfolder-prefixed image combo values
Steps to Reproduce
How to Reproduce
- Use any custom node with an image combo input (
image_upload: true) whose combo values include subfolder-prefixed paths (e.g. subfolder/image.png)
- Enable Nodes 2.0 renderer
- Click the image combo widget to open the popup selector
- Observe that thumbnails for any subfolder-prefixed image fail to load (broken image icon / 404)
- Selecting the image works fine (the preview/execution uses
get_annotated_filepath() which handles the full path), but the thumbnail in the dropdown is broken
The built-in LoadImage node is not affected because it uses os.listdir() (non-recursive), so its combo values never contain subfolder prefixes. Any custom node that scans subfolders recursively and returns paths like subfolder/filename.png in its combo values will hit this bug.
How is this affecting you?
Crashes ComfyUI completely
ComfyUI Frontend Version
1.43.18
Browser
Chrome/Chromium
Console Errors
Logs
Additional Context
No response
Prerequisites
What happened?
Broken Thumbnails for Subfolder-Prefixed Image Combo Values in WidgetSelectDropdown
Description
The
getMediaUrl()function inWidgetSelectDropdown.vuepasses the raw combo widget value as a singlefilenamequery parameter to/api/view. When a combo value contains a subfolder path (e.g.ipadapter/Alyson/image.png), the resulting URL is:The
/api/viewhandler inserver.py(line 541) callsos.path.basename(filename), which strips the subfolder portion, then looks forimage.pngdirectly in the root input directory. The file isn't there — it's ininput/ipadapter/Alyson/— so the request returns 404 and the thumbnail is broken.Root Cause
getMediaUrl()atWidgetSelectDropdown.vue:519-528:The function does not split the subfolder prefix out of
filename. The/api/viewendpoint already supports a separatesubfolderquery parameter (server.py:535-539), and the codebase already has a utility that performs the correct split —parseImageWidgetValue()insrc/utils/imageUtil.ts.Other parts of the codebase handle this correctly. For example,
ResultItemImpl.urlParamsinqueueStore.tspassesfilenameandsubfolderas separate parameters.Suggested Fix
Use
parseImageWidgetValue()to split the value before building the URL:Expected Behavior
Thumbnails should load correctly for combo values containing subfolder paths. The URL should be constructed as:
Environment
Steps to Reproduce
How to Reproduce
image_upload: true) whose combo values include subfolder-prefixed paths (e.g.subfolder/image.png)get_annotated_filepath()which handles the full path), but the thumbnail in the dropdown is brokenThe built-in
LoadImagenode is not affected because it usesos.listdir()(non-recursive), so its combo values never contain subfolder prefixes. Any custom node that scans subfolders recursively and returns paths likesubfolder/filename.pngin its combo values will hit this bug.How is this affecting you?
Crashes ComfyUI completely
ComfyUI Frontend Version
1.43.18
Browser
Chrome/Chromium
Console Errors
Logs
Additional Context
No response