fix: allow runtime image attachment paths

This commit is contained in:
ejclaw
2026-05-02 22:00:07 +09:00
parent daeea621d8
commit 6356b76836
8 changed files with 66 additions and 40 deletions

View File

@@ -111,6 +111,27 @@ describe('validateOutboundAttachments', () => {
]);
});
it('accepts generated image files in nested temp directories', () => {
const dir = makeTempDir(os.tmpdir(), 'paladin-character-');
const imagePath = writeFile(dir, 'sheet_12x.png', ONE_PIXEL_PNG);
const result = validateOutboundAttachments([
{
path: imagePath,
name: 'sheet_12x.png',
mime: 'image/png',
},
]);
expect(result.rejected).toEqual([]);
expect(result.files).toEqual([
{
attachment: fs.realpathSync(imagePath),
name: 'sheet_12x.png',
},
]);
});
it('requires workspace paths to be explicitly allowlisted', () => {
const dir = makeTempDir(process.cwd(), '.ejclaw-attachment-');
const imagePath = writeFile(dir, 'workspace-shot.png', ONE_PIXEL_PNG);