MCPcopy
hub / github.com/wavetermdev/waveterm / isAcceptableFile

Function isAcceptableFile

frontend/app/aipanel/ai-utils.ts:13–201  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

11const ImageMaxEdge = 4096;
12
13export const isAcceptableFile = (file: File): boolean => {
14 const acceptableTypes = [
15 // Images
16 "image/jpeg",
17 "image/jpg",
18 "image/png",
19 "image/gif",
20 "image/webp",
21 "image/svg+xml",
22 // PDFs
23 "application/pdf",
24 // Text files
25 "text/plain",
26 "text/markdown",
27 "text/html",
28 "text/css",
29 "text/javascript",
30 "text/typescript",
31 // Application types for code files
32 "application/javascript",
33 "application/typescript",
34 "application/json",
35 "application/xml",
36 ];
37
38 if (acceptableTypes.includes(file.type)) {
39 return true;
40 }
41
42 // Check file extensions for files without proper MIME types
43 const extension = file.name.split(".").pop()?.toLowerCase();
44 const acceptableExtensions = [
45 "txt",
46 "log",
47 "md",
48 "js",
49 "mjs",
50 "cjs",
51 "jsx",
52 "ts",
53 "mts",
54 "cts",
55 "tsx",
56 "go",
57 "py",
58 "java",
59 "c",
60 "cpp",
61 "h",
62 "hpp",
63 "html",
64 "htm",
65 "css",
66 "scss",
67 "sass",
68 "json",
69 "jsonc",
70 "json5",

Callers 2

handleDropFunction · 0.90
addFileFromRemoteUriMethod · 0.90

Calls 1

popMethod · 0.80

Tested by

no test coverage detected