mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 00:47:57 +00:00
fix: normalize BOM-prefixed plugin manifests (#3342)
This commit is contained in:
@@ -160,13 +160,17 @@ describe("package-inspector-nightly-scan", () => {
|
||||
expect(config.plugin.id).toBe(expectedId);
|
||||
});
|
||||
|
||||
it("accepts a UTF-8 BOM before a downloaded package.json", async () => {
|
||||
it("accepts a UTF-8 BOM before downloaded plugin manifests", async () => {
|
||||
const pluginRoot = await mkdtemp(path.join(tmpdir(), "clawhub-inspector-package-json-"));
|
||||
temporaryRoots.push(pluginRoot);
|
||||
await writeFile(
|
||||
path.join(pluginRoot, "package.json"),
|
||||
'\uFEFF{"name":"eu-compliance-skill","version":"1.0.1"}\n',
|
||||
);
|
||||
await writeFile(
|
||||
path.join(pluginRoot, "openclaw.plugin.json"),
|
||||
'\uFEFF{"id":"eu-compliance-skill"}\n',
|
||||
);
|
||||
|
||||
await expect(
|
||||
prepareExtractedPluginRoot(pluginRoot, "npm-pack", "eu-compliance-skill"),
|
||||
@@ -178,6 +182,9 @@ describe("package-inspector-nightly-scan", () => {
|
||||
expect(await readFile(path.join(pluginRoot, "package.json"), "utf8")).toBe(
|
||||
'{"name":"eu-compliance-skill","version":"1.0.1"}\n',
|
||||
);
|
||||
expect(await readFile(path.join(pluginRoot, "openclaw.plugin.json"), "utf8")).toBe(
|
||||
'{"id":"eu-compliance-skill"}\n',
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
|
||||
@@ -376,6 +376,7 @@ export async function prepareExtractedPluginRoot(
|
||||
if (artifactKind === "legacy-zip") {
|
||||
await removePosixArchiveMetadata(scanRoot);
|
||||
}
|
||||
await readJsonIfExists(path.join(scanRoot, "openclaw.plugin.json"));
|
||||
await writeSyntheticConfigIfNeeded(scanRoot, packageName);
|
||||
return scanRoot;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user