Skip to content

Definition import: strip UTF BOM#15550

Merged
michaelklishin merged 2 commits intomainfrom
rabbitmq-server-13748
Feb 24, 2026
Merged

Definition import: strip UTF BOM#15550
michaelklishin merged 2 commits intomainfrom
rabbitmq-server-13748

Conversation

@michaelklishin
Copy link
Copy Markdown
Collaborator

@michaelklishin michaelklishin commented Feb 24, 2026

Definition import: strip leading UTF BOM

Originally proposed in #15527 by @danielalanbates.

Borrows a function from our rabbitmq.conf parser,
see Kyorai/cuttlefish#64.

Fixes #13748.

Your Name and others added 2 commits February 24, 2026 08:33
The UTF-8 BOM (byte order mark, EF BB BF) is a three-byte sequence that
some editors prepend to UTF-8 encoded files. The JSON parser does not
strip it automatically, causing definition import to fail with a JSON
parse error.

Add a pattern-match clause to the decode/1 functions in both
rabbit_definitions and rabbit_mgmt_wm_definitions to strip the BOM
before attempting to parse the body as JSON.
Originally proposed in #15527.

Borrows a function from our rabbitmq.conf parser,
see Kyorai/cuttlefish#64.

Fixes #13748.
@michaelklishin michaelklishin merged commit a382228 into main Feb 24, 2026
350 of 352 checks passed
@michaelklishin michaelklishin deleted the rabbitmq-server-13748 branch February 24, 2026 17:09
Copy link
Copy Markdown
Collaborator

@lukebakken lukebakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@danielalanbates
Copy link
Copy Markdown

Thank you for the review! Glad it helps. 🙏

michaelklishin added a commit that referenced this pull request Feb 24, 2026
Definition import: strip UTF BOM (backport #15550)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Definition import should ignore the UTF-8 BOM of the uploaded file

3 participants