- cleanup-workflow.js: Filter only embedded data: images from outputGallery
instead of wiping entire array; preserve imageRef/video on output nodes
- workflow/route.ts: Validate parsed.version is number, nodes/edges are
arrays; sort candidates by mtime desc for deterministic file selection
- mediaStorage.ts: Guard against undefined mediaData in loadMediaById
before caching/returning
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused isBase64DataUrl legacy alias from mediaStorage.ts
- Move cleanup-workflow.js to scripts/ directory
- Add parallel batch processing (batch size 3) to hydrateWorkflowMedia,
matching the pattern already used by externalizeWorkflowMedia
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
OutputGallery nodes were not being handled in externalizeWorkflowImages(),
causing their images arrays (which can contain dozens of high-res base64
images) to remain embedded in workflow JSON even when "Embed images as
base64" was disabled.
This caused workflow files to balloon to 500MB+ and hit JavaScript's
"Invalid string length" limit when saving.
Changes:
- Add outputGallery case to externalizeNodeImages() to clear images array
- Add outputGallery case to hydrateNodeImages() for consistency
- Add cleanup-workflow.js script for fixing existing affected workflows
OutputGallery content is display-only and regenerated on workflow execution,
so it doesn't need to be persisted.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>