Comfy-Org / Comfy-Org/ComfyUI_frontend

[Bug] Failed to load workflows from long Opus/Ogg files (SyntaxError due to OggS page breaks)

Open
#9,256 1 comment 0 reactions 0 assignees View on GitHub
area:workflows
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

### Description
When dragging and dropping an `.opus` or `.ogg` file containing a saved workflow, if the metadata (or the file itself) is very large, a `SyntaxError: Unexpected token 'O', "OggS"... is not valid JSON` occurs and the workflow fails to load.

### Cause
Ogg container specification splits data into pages (typically around 64KB). When a long workflow JSON is embedded in the OpusTags (Vorbis Comment), `OggS` magic byte headers are inserted into the middle of the JSON string across page boundaries.
The current regex-based string matching in `src/scripts/metadata/ogg.ts` does not account for these interleaved page headers, causing it to extract a corrupted JSON string containing `OggS`.

### Proposed Solution
Rewrite `getOggMetadata` in `ogg.ts` to properly demux the Ogg container, aggregate the OpusTags packets by discarding the `OggS` page headers and segment tables, and decode the binary data before parsing the JSON.

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-9256-Bug-Failed-to-load-workflows-from-long-Opus-Ogg-files-SyntaxError-due-to-OggS-page--3136d73d36508107829bd264aed210a3) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.