mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-28 14:10:37 +00:00
fix(frontend): key the Julia entry of extensionMap by its extension (#6130)
extensionMap is keyed by extension and valued by language, but the Julia row was written backwards as `julia: "jl"`. checkCodeFile tests membership with `extension in extensionMap`, so ".jl" never matched and a Julia artifact was not a code file at all, while ".julia" resolved to a language named "jl". Add both `jl: "julia"` and `julia: "julia"`, the same pair form the map already uses for haskell/hs and elixir/ex, so no extension that classified before stops classifying.
This commit is contained in:
parent
5c6c074542
commit
241a7b3b9b
@ -109,7 +109,8 @@ const extensionMap: Record<string, string> = {
|
||||
lua: "lua",
|
||||
r: "r",
|
||||
matlab: "matlab",
|
||||
julia: "jl",
|
||||
julia: "julia",
|
||||
jl: "julia",
|
||||
elm: "elm",
|
||||
haskell: "haskell",
|
||||
hs: "haskell",
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
import { expect, test } from "@rstest/core";
|
||||
import { FilePlayIcon, FileTextIcon, ImageIcon } from "lucide-react";
|
||||
|
||||
import { canBrowserPreviewFile, getFileIcon } from "@/core/utils/files";
|
||||
import {
|
||||
canBrowserPreviewFile,
|
||||
checkCodeFile,
|
||||
getFileIcon,
|
||||
} from "@/core/utils/files";
|
||||
|
||||
test.each([
|
||||
["animation.apng", ImageIcon],
|
||||
@ -15,3 +19,28 @@ test.each([
|
||||
test("keeps the document icon for an unknown extension", () => {
|
||||
expect(getFileIcon("data.unknown").type).toBe(FileTextIcon);
|
||||
});
|
||||
|
||||
// `extensionMap` maps a file extension to a language name. Both halves of that
|
||||
// direction matter: `checkCodeFile` tests extension membership, and the language
|
||||
// is what the editor and previewers receive.
|
||||
test("resolves a language from its extension", () => {
|
||||
expect(checkCodeFile("script.hs")).toEqual({
|
||||
isCodeFile: true,
|
||||
language: "haskell",
|
||||
});
|
||||
expect(checkCodeFile("deploy.ex")).toEqual({
|
||||
isCodeFile: true,
|
||||
language: "elixir",
|
||||
});
|
||||
expect(checkCodeFile("analysis.jl")).toEqual({
|
||||
isCodeFile: true,
|
||||
language: "julia",
|
||||
});
|
||||
});
|
||||
|
||||
test("values the language name, never the extension it came from", () => {
|
||||
expect(checkCodeFile("notes.julia")).toEqual({
|
||||
isCodeFile: true,
|
||||
language: "julia",
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user