perform filereads through backend class

This commit is contained in:
Simon Knott 2024-11-07 16:41:08 +01:00
parent cdcf06e3a8
commit ae0cf8b14b
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -148,7 +148,15 @@ async function doFetch(event: FetchEvent): Promise<Response> {
return new Response(null, { status: 404 });
}
// Fallback to network.
if (relativePath.startsWith('/file/')) {
const path = url.searchParams.get('path')!;
const response = await traceViewerServer.readFile(path);
if (!response)
return new Response(null, { status: 404 });
return response;
}
// Fallback for static assets.
return fetch(event.request);
}