[backport core/1.33] Fix workflow loading from PNG images with both workflow and parameter…#7265
Merged
christian-byrne merged 2 commits intocore/1.33from Dec 9, 2025
Merged
Conversation
#7154) …s metadata - Reorder handleFile() to check workflow before parameters - Add validation to prevent JSON parse errors from crashing imports - Fix loadGraphData() to use explicit type validation instead of falsy check - Ensures ComfyUI-generated PNGs with both metadata types load the workflow, not parameters Fixes issue where large workflows (e.g., 634 nodes) were replaced with basic A1111 format when importing PNG files. ## Summary Fixed workflow loading from PNG images to prioritize workflow metadata over parameters, preventing large workflows from being replaced with basic A1111 format. ## Changes - **What**: Reordered `handleFile()` to check workflow before parameters, added JSON parse error handling and validation, fixed `loadGraphData()` to use explicit type checking instead of falsy check - **Dependencies**: None ## Review Focus The key issue was in `handleFile()` where parameters were checked before workflow, causing ComfyUI-generated PNGs (which contain both workflow and parameters metadata) to incorrectly import as A1111 format. The fix ensures: 1. Workflow is always checked first and validated properly 2. Parameters are only used as a fallback when no workflow exists 3. Invalid/malformed workflow data doesn't crash the import process Additionally, `loadGraphData()` was using a falsy check (`if (!graphData)`) which could incorrectly replace valid but falsy values. Now uses explicit type validation. Tested with real-world PNG containing 634-node workflow (780KB) + parameters (1KB) - now correctly loads the workflow instead of discarding it. <!-- Fixes #ISSUE_NUMBER --> ## Screenshots (if applicable) N/A - Backend logic fix, no UI changes Fixes #6633 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7154-Fix-workflow-loading-from-PNG-images-with-both-workflow-and-parameter-2bf6d73d365081ecb7a6c4bf6b6ccd51) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <DrJKL0424@gmail.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 12/09/2025, 12:55:54 AM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Test Results❌ Some tests failed ⏰ Completed at: 12/09/2025, 01:04:42 AM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
🔧 Auto-fixes AppliedThis PR has been automatically updated to fix linting and formatting issues.
Changes made:
|
christian-byrne
approved these changes
Dec 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #7154 to
core/1.33Automatically created by backport workflow.
┆Issue is synchronized with this Notion page by Unito