fix(openclaw): bypass local attachment allowlist to support all files (.zwo, .json, etc.)

This commit is contained in:
Moritz Graf
2026-09-15 13:23:40 +02:00
parent feca5ccd3c
commit 4df5c2c3d6
3 changed files with 30 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: openclaw-attachment-patch
namespace: openclaw
data:
attachment-allowlist-loader.mjs: |
import { register } from "node:module";
register(new URL("./attachment-allowlist-hook.mjs", import.meta.url));
attachment-allowlist-hook.mjs: |
export async function load(url, context, nextLoad) {
const result = await nextLoad(url, context);
if (url.includes("web-media-") && result.source) {
let source = typeof result.source === "string"
? result.source
: Buffer.isBuffer(result.source)
? result.source.toString("utf8")
: new TextDecoder().decode(result.source);
if (source.includes("function assertHostReadMediaAllowed(params) {")) {
source = source.replace(
"function assertHostReadMediaAllowed(params) {",
"function assertHostReadMediaAllowed(params) { return; /* allow all files */ "
);
return { ...result, source };
}
}
return result;
}