svg_preview: Detect SVG in single-file mode by checking file name (#45747)

Gabe Shahbazian created

Release Notes:

- Use the files name for "is svg" checks so SVG previews and the toolbar
button work in single-file mode.

Change summary

crates/svg_preview/src/svg_preview_view.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

crates/svg_preview/src/svg_preview_view.rs 🔗

@@ -196,7 +196,7 @@ impl SvgPreviewView {
             .as_singleton()
             .and_then(|buffer| buffer.read(cx).file())
             .is_some_and(|file| {
-                file.path()
+                std::path::Path::new(file.file_name(cx))
                     .extension()
                     .is_some_and(|ext| ext.eq_ignore_ascii_case("svg"))
             })