Fix fallback for non-image files - #63455
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @ThatKJ on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
We require contributors to sign our Contributor License Agreement, and we don't have @ThatKJ on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
Thank you, this is a nice idea but the fix has to be a bit more generic, something similar to #63160 , and, ideally, avoid extra error handling in this way, as it's quite error-prone. |
Fixes #63449
The image viewer was picking files based on their extension before checking if the file was actually an image. Because of that, a normal text file like
test.pamwould end up showing the broken image view instead of opening in the editor.This changes the opening flow so that if the image viewer checks the file and doesn't recognize it as an image, Workspace can try the next opener instead.
Valid images still open normally, and image decoding errors are still handled by the image viewer.
Added a regression test using a text
test.pamfile.Tested with:
cargo test -p image_viewer --libcargo test -p workspace --lib register_project_item_testscargo fmt -- --check./script/clippy -p project -p workspace -p image_viewerRelease Notes: