juftin / browsr

🗂️ a pleasant file explorer in your terminal supporting all filesystems
http://juftin.com/browsr/
MIT License
225 stars 13 forks source link

Freezes and shows junk when previewing a binary file #12

Closed Slackadays closed 1 year ago

Slackadays commented 1 year ago

I'm trying out browsr and I came across a nasty bug: if I preview a file that's just binary data, some of that data makes its way out of the preview window and if it's a lot of data, browsr freezes despite running on a hulking Ryzen 5900X. Here's a video that makes this clearer :)

https://github.com/juftin/browsr/assets/69403549/a95bd003-695f-4b8d-bec2-ab1a873e48be

juftin commented 1 year ago

oooh, yikes. This looks like an issue with the underlying TUI framework, textual. It seems like some non utf-8 characters are throwing it off. I will follow up with the maintainers of that package to see what can be done.

Previously, I didn't even bother to try to read binary files like this and instead just showed a message like "Encoding Error". Just curious, as a user of browsr would you rather it try to load these files (with the risk of this weird error) or just not bother?

Thank you for reporting the issue!

juftin commented 1 year ago

I ended up just raising an error when a file's contents can't be properly encoded. There are just too many problematic characters possible in a binary file that can corrupt a TUI app. image