Compare commits

...

2 Commits

Author SHA1 Message Date
Johnpaul Chiwetelu
7856e40458 Merge branch 'main' into fix/load-image-output-ds-store 2025-12-06 04:13:42 +01:00
Johnpaul
61c566e585 [bugfix] Fix Load Image (from Outputs) node failing on macOS
Filter out .DS_Store and placeholder files from remote widget file lists.

On macOS, the .DS_Store file (a hidden system file created by Finder) was
being included in the output folder file list. When the "Load Image (from
Outputs)" node refreshed, it would select .DS_Store as the first file,
causing the image preview to fail with an error since .DS_Store is not a
valid image file.

This fix filters out .DS_Store and the _output_images_will_be_put_here
placeholder file from file lists returned by remote widget API calls.
2025-12-06 03:56:18 +01:00

View File

@@ -65,6 +65,19 @@ const isBackingOff = (entry: CacheEntry<unknown> | undefined) =>
entry?.lastErrorTime &&
Date.now() - entry.lastErrorTime < getBackoff(entry.retryCount || 0)
// Filter out invalid files like .DS_Store
const filterFileList = <T>(data: T): T => {
if (!Array.isArray(data)) return data
return data.filter((item) => {
if (typeof item !== 'string') return true
const basename = item.split('/').pop() ?? ''
if (['_output_images_will_be_put_here', '.DS_Store'].includes(basename)) {
return false
}
return true
}) as T
}
const fetchData = async (
config: RemoteWidgetConfig,
controller: AbortController
@@ -80,7 +93,8 @@ const fetchData = async (
...authHeaders
})
return response_key ? res.data[response_key] : res.data
const data = response_key ? res.data[response_key] : res.data
return filterFileList(data)
}
export function useRemoteWidget<