From 42b8b1fc99f8097ed78f6a097f0d78764dbea04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Liu=20=E5=AE=9D=E7=8E=89?= Date: Wed, 11 Mar 2026 22:46:06 -0500 Subject: [PATCH] fix: use proper MIME types in skill publish to fix ClawhHub rejection --- scripts/publish-skill.mjs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/publish-skill.mjs b/scripts/publish-skill.mjs index e22bad7..07d43e3 100644 --- a/scripts/publish-skill.mjs +++ b/scripts/publish-skill.mjs @@ -220,7 +220,7 @@ async function publishSkill({ registry, token, skill, files, version, changelog, ); for (const file of files) { - form.append("files", new Blob([file.bytes], { type: "application/octet-stream" }), file.relPath); + form.append("files", new Blob([file.bytes], { type: mimeType(file.relPath) }), file.relPath); } const response = await fetch(`${registry}/api/v1/skills`, { @@ -281,6 +281,26 @@ function titleCase(value) { .replace(/\b\w/g, (char) => char.toUpperCase()); } +const MIME_MAP = { + ".md": "text/markdown", + ".ts": "text/plain", + ".js": "text/javascript", + ".mjs": "text/javascript", + ".json": "application/json", + ".yml": "text/yaml", + ".yaml": "text/yaml", + ".txt": "text/plain", + ".html": "text/html", + ".css": "text/css", + ".xml": "text/xml", + ".svg": "image/svg+xml", +}; + +function mimeType(relPath) { + const ext = path.extname(relPath).toLowerCase(); + return MIME_MAP[ext] || "text/plain"; +} + function parseBoolean(value) { return ["1", "true", "yes", "on"].includes(String(value).trim().toLowerCase()); }