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 15:01:52 +00:00
committed by GitHub
parent 5589e78a69
commit 632f08d2a3
+2 -2
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)
});