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

Release Notes:

- Use the files name for "is svg" checks so SVG previews and the toolbar
button work in single-file mode.
This commit is contained in:
Gabe Shahbazian
2025-12-27 15:29:36 -08:00
committed by GitHub
parent bc24ffe863
commit 2cad6c8ef1

View File

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