project: Check path extension first, then worktree's (#29671)

This fixes a bug with opening images on worktrees that contain
"extension" in the dir name, like `zed.dev`


Release Notes:

- N/A
This commit is contained in:
Oleksiy Syvokon 2025-04-30 18:01:52 +03:00 committed by GitHub
parent 5589e78a69
commit 632f08d2a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -217,9 +217,9 @@ pub fn is_image_file(project: &Entity<Project>, path: &ProjectPath, cx: &App) ->
.worktree_for_id(path.worktree_id, cx)?
.read(cx)
.abs_path();
worktree_abs_path
path.path
.extension()
.or_else(|| path.path.extension())
.or_else(|| worktree_abs_path.extension())
.and_then(OsStr::to_str)
.map(str::to_lowercase)
});