Skip to content

Commit 20c2341

Browse files
committed
fix(sandbox): validate required opts in pptx addImage
1 parent 449ed27 commit 20c2341

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/sim/sandbox-tasks/pptx-generate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ export const pptxGenerateTask = defineSandboxTask<SandboxTaskInput>({
5252
* Example: await addImage(slide, 'abc123', { x: 0.5, y: 1, w: 2, h: 1 });
5353
*/
5454
globalThis.addImage = async function addImage(slide, fileId, opts) {
55+
if (!opts || opts.x == null || opts.y == null || opts.w == null || opts.h == null) {
56+
throw new Error('addImage: opts must include x, y, w, and h (in inches)');
57+
}
5558
const data = await globalThis.getFileBase64(fileId);
56-
slide.addImage(Object.assign({}, opts || {}, { data }));
59+
slide.addImage(Object.assign({}, opts, { data }));
5760
};
5861
`,
5962
finalize: `

0 commit comments

Comments
 (0)