mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
Allow validated text document media sends
This commit is contained in:
committed by
Peter Steinberger
parent
d641126c1d
commit
1e14f4400f
@@ -109,6 +109,20 @@ describe("mime detection", () => {
|
||||
}),
|
||||
expected: "text/javascript",
|
||||
},
|
||||
{
|
||||
name: "uses extension mapping for YAML assets",
|
||||
input: async () => ({
|
||||
filePath: "/tmp/config.yml",
|
||||
}),
|
||||
expected: "application/yaml",
|
||||
},
|
||||
{
|
||||
name: "uses extension mapping for YAML documents",
|
||||
input: async () => ({
|
||||
filePath: "/tmp/config.yaml",
|
||||
}),
|
||||
expected: "application/yaml",
|
||||
},
|
||||
] as const)("$name", async ({ input, expected }) => {
|
||||
await expectDetectedMime({
|
||||
input: await input(),
|
||||
@@ -182,6 +196,8 @@ describe("mimeTypeFromFilePath", () => {
|
||||
{ filePath: "clip.flv", expected: "video/x-flv" },
|
||||
{ filePath: "clip.wmv", expected: "video/x-ms-wmv" },
|
||||
{ filePath: "debug.log", expected: "text/plain" },
|
||||
{ filePath: "config.yml", expected: "application/yaml" },
|
||||
{ filePath: "config.yaml", expected: "application/yaml" },
|
||||
{ filePath: "page.xml", expected: "text/xml" },
|
||||
{ filePath: "unknown.bin", expected: undefined },
|
||||
] as const)("maps $filePath", ({ filePath, expected }) => {
|
||||
@@ -221,6 +237,7 @@ describe("extensionForMime", () => {
|
||||
{ mime: "video/x-ms-wmv", expected: ".wmv" },
|
||||
{ mime: "video/quicktime", expected: ".mov" },
|
||||
{ mime: "application/pdf", expected: ".pdf" },
|
||||
{ mime: "application/yaml", expected: ".yaml" },
|
||||
{ mime: "text/plain", expected: ".txt" },
|
||||
{ mime: "text/markdown", expected: ".md" },
|
||||
{ mime: "text/html", expected: ".html" },
|
||||
|
||||
@@ -38,6 +38,7 @@ const EXT_BY_MIME: Record<string, string> = {
|
||||
"video/quicktime": ".mov",
|
||||
"application/pdf": ".pdf",
|
||||
"application/json": ".json",
|
||||
"application/yaml": ".yaml",
|
||||
"application/zip": ".zip",
|
||||
"application/gzip": ".gz",
|
||||
"application/x-tar": ".tar",
|
||||
@@ -79,6 +80,7 @@ const MIME_BY_EXT: Record<string, string> = {
|
||||
".log": "text/plain",
|
||||
".htm": "text/html",
|
||||
".xml": "text/xml",
|
||||
".yml": "application/yaml",
|
||||
};
|
||||
|
||||
const AUDIO_FILE_EXTENSIONS = new Set([
|
||||
|
||||
Reference in New Issue
Block a user