mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:31:24 +00:00
fix(sandbox): normalize /workspace media paths to host sandbox root
Co-authored-by: echo931 <echo931@users.noreply.github.com>
This commit is contained in:
@@ -585,6 +585,27 @@ describe("runMessageAction sandboxed media validation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("rewrites /workspace media paths to host sandbox root", async () => {
|
||||
await withSandbox(async (sandboxDir) => {
|
||||
const result = await runDrySend({
|
||||
cfg: slackConfig,
|
||||
actionParams: {
|
||||
channel: "slack",
|
||||
target: "#C12345678",
|
||||
media: "/workspace/data/file.txt",
|
||||
message: "",
|
||||
},
|
||||
sandboxRoot: sandboxDir,
|
||||
});
|
||||
|
||||
expect(result.kind).toBe("send");
|
||||
if (result.kind !== "send") {
|
||||
throw new Error("expected send result");
|
||||
}
|
||||
expect(result.sendResult?.mediaUrl).toBe(path.join(sandboxDir, "data", "file.txt"));
|
||||
});
|
||||
});
|
||||
|
||||
it("rewrites MEDIA directives under sandbox", async () => {
|
||||
await withSandbox(async (sandboxDir) => {
|
||||
const result = await runDrySend({
|
||||
|
||||
Reference in New Issue
Block a user