Skip to content

fix: coerce Blob values to string in format_file_display#342

Merged
dmtrKovalenko merged 1 commit intodmtrKovalenko:mainfrom
tmchow:fix/310-backslash-blob-crash
Apr 6, 2026
Merged

fix: coerce Blob values to string in format_file_display#342
dmtrKovalenko merged 1 commit intodmtrKovalenko:mainfrom
tmchow:fix/310-backslash-blob-crash

Conversation

@tmchow
Copy link
Copy Markdown
Contributor

@tmchow tmchow commented Apr 6, 2026

vim.json.decode returns Blobs instead of strings when the decoded value contains NUL bytes. In format_file_display, item.name and item.directory flow straight into strdisplaywidth which triggers E976.

Added the same type guard that grep_renderer.lua already uses for line_content.

Fixes #310

vim.json.decode returns Blobs instead of strings when the decoded
value contains NUL bytes. Passing a Blob to strdisplaywidth triggers
E976. Guard item.name and item.directory the same way
grep_renderer.lua already guards line_content.

Fixes dmtrKovalenko#310
@tmchow tmchow mentioned this pull request Apr 6, 2026
@dmtrKovalenko
Copy link
Copy Markdown
Owner

Thank you! I once started working on the fix but then got interested why some items contain NUL and never delivered 😭😭😭

Do you know by any chance?

@dmtrKovalenko dmtrKovalenko merged commit 59d626d into dmtrKovalenko:main Apr 6, 2026
40 of 41 checks passed
@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Apr 6, 2026

Thank you! I once started working on the fix but then got interested why some items contain NUL and never delivered 😭😭😭

Do you know by any chance?

I don't!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crashing when pressing '\'

2 participants