Repository navigation
feat(grid): make BLOB columns readable (#401) - #632
Merged
Merged
Conversation
FR-3.1.9. A BLOB arrives as an array of bytes and was rendered with `String(value)`, so a PNG stored in a MEDIUMBLOB showed as `137,80,78,71,13,10,26,10,…` — every byte, comma-separated. That is not a preview of anything (#401). The cell now says what the value is and how big: `[image/png, 12.4 KB]`. The type comes from the bytes themselves, because a result set carries no filename and no column comment to read it from. Opening one gives the three views the requirement asks for, and which opens first is decided by the bytes. An image opens as an image; something that reads as text opens as text; anything else opens as hex — for a compiled blob the hex *is* the content, and dropping the user on an empty-looking text pane would suggest the value was empty. Views that cannot say anything are not offered. An image tab on bytes no `<img>` can render is a broken-icon placeholder, which is worse than no tab. An SVG gets all three, since it is both. The text view decodes non-fatally, so a blob that is mostly text with one stray byte is still readable with U+FFFD marking where it went wrong. Around the edges: - Hex stops at 64 KB and says so. A 50 MB value is 3.2 million lines, and building them all to show the first screenful locks the window up. - Copy puts hex on the clipboard rather than `137,80,78,71`. Pasting a byte array into anything is useless; hex round-trips through UNHEX(). - Download saves the bytes under the type they claim to be, with a matching extension. Saving a PNG as `column.txt` loses the only thing that made it openable. - Edit is disabled: there is no text form, and round-tripping one through the editor would corrupt the value. Verified against MEDIUMBLOB, BLOB and VARBINARY columns on MySQL 8.0.46. Co-Authored-By: Claude Opus 5 <[email protected]>
EVWorth
force-pushed
the
feat/results-blob-viewer
branch
from
September 11, 2026 05:29
bbf65d4 to
4c14eb7
Compare
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.
Stacked on #631.
FR-3.1.9. A BLOB arrives as an array of bytes and was rendered with
String(value), so a PNG stored in aMEDIUMBLOBshowed as137,80,78,71,13,10,26,10,…— every byte, comma-separated. That is not a preview of anything.The cell now says what the value is and how big:
[image/png, 12.4 KB]. The type comes from the bytes themselves, because a result set carries no filename and no column comment to read it from.Opening one gives the three views the requirement asks for, and which opens first is decided by the bytes. An image opens as an image; something that reads as text opens as text; anything else opens as hex — for a compiled blob the hex is the content, and dropping the user on an empty-looking text pane would suggest the value was empty.
Views that cannot say anything are not offered. An image tab on bytes no
<img>can render is a broken-icon placeholder, which is worse than no tab. An SVG gets all three, since it is both. The text view decodes non-fatally, so a blob that is mostly text with one stray byte is still readable with U+FFFD marking where it went wrong.Around the edges
137,80,78,71. Pasting a byte array into anything is useless; hex round-trips throughUNHEX().column.txtloses the only thing that made it openable.Verification
2374 unit tests (29 on the byte helpers, 12 on the viewer, 4 on the cell) and 331 browser tests. Verified against
MEDIUMBLOB,BLOBandVARBINARYcolumns on live MySQL 8.0.46 — including confirming the old rendering was exactly what the issue described.Also fixed two flaky assertions in
ResultsGrid.test.tsxthat waited on the schema call rather than on the state that follows it.Closes #401
🤖 Generated with Claude Code