( req: HTTPRequest, absWorkspace: string, previewFilePath: string, )
| 312 | } |
| 313 | |
| 314 | async 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 | |
| 334 | function mapConsoleLevel(raw: string): PreviewResult['consoleErrors'][number]['level'] | null { |
| 335 | switch (raw) { |
no test coverage detected