MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / handlePreviewRequest

Function handlePreviewRequest

apps/desktop/src/main/preview-runtime.ts:314–332  ·  view source on GitHub ↗
(
  req: HTTPRequest,
  absWorkspace: string,
  previewFilePath: string,
)

Source from the content-addressed store, hash-verified

312}
313
314async function handlePreviewRequest(
315 req: HTTPRequest,
316 absWorkspace: string,
317 previewFilePath: string,
318): Promise<void> {
319 try {
320 if (!(await isPreviewFileUrlAllowed(req.url(), absWorkspace, previewFilePath))) {
321 await req.abort('blockedbyclient');
322 return;
323 }
324 await req.continue();
325 } catch {
326 try {
327 await req.abort('failed');
328 } catch {
329 /* noop */
330 }
331 }
332}
333
334function mapConsoleLevel(raw: string): PreviewResult['consoleErrors'][number]['level'] | null {
335 switch (raw) {

Callers 1

runPreviewFunction · 0.85

Calls 3

isPreviewFileUrlAllowedFunction · 0.85
abortMethod · 0.80
continueMethod · 0.80

Tested by

no test coverage detected