fix(markdown): correct image gallery rendering (#2894)
This commit is contained in:
@@ -45,6 +45,7 @@ The webview CSP permits `blob:` only for `worker-src` so shared UI parsers can r
|
||||
|
||||
- `bridge-localfs-proxy-runtime.ts`
|
||||
- Local `/api/fs/read` and `/api/fs/raw` proxy helpers and shared proxy utility helpers.
|
||||
- Returns an explicit unsupported response for server-owned Markdown image grants instead of forwarding them to OpenCode.
|
||||
|
||||
- `bridge-proxy-runtime.ts`
|
||||
- Proxy route handlers (`api:proxy`, `api:session:message`) with injected helper dependencies.
|
||||
|
||||
@@ -37,6 +37,14 @@ mock.module('vscode', () => ({
|
||||
const { tryHandleLocalFsProxy } = await import('./bridge-localfs-proxy-runtime');
|
||||
|
||||
describe('bridge local fs proxy', () => {
|
||||
it('does not forward server-owned Markdown image grant routes to OpenCode', async () => {
|
||||
const response = await tryHandleLocalFsProxy('POST', '/api/openchamber/sessions/ses_1/markdown-image-grants');
|
||||
|
||||
expect(response?.status).toBe(501);
|
||||
expect(Buffer.from(response?.bodyBase64 ?? '', 'base64').toString('utf8'))
|
||||
.toContain('not supported in the VS Code runtime');
|
||||
});
|
||||
|
||||
it('returns a quiet optional stat miss for missing files', async () => {
|
||||
const response = await tryHandleLocalFsProxy('GET', '/api/fs/stat?path=%2Fmissing.ts&optional=true');
|
||||
|
||||
|
||||
@@ -56,6 +56,9 @@ export const tryHandleLocalFsProxy = async (method: string, requestPath: string)
|
||||
}
|
||||
|
||||
const fsProxyPath = normalizeFsProxyPath(parsed.pathname);
|
||||
if (/^\/api\/openchamber\/sessions\/[^/]+\/markdown-image-grants$/.test(parsed.pathname)) {
|
||||
return buildProxyJsonError(501, 'Markdown image grants are not supported in the VS Code runtime');
|
||||
}
|
||||
if (!fsProxyPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user