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

Oleksiy Syvokon created

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


Release Notes:

- N/A

Change summary

crates/project/src/image_store.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Detailed changes

crates/project/src/image_store.rs 🔗

@@ -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)
     });