fix(openclaw): bypass local attachment allowlist to support all files (.zwo, .json, etc.)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user