From 53000f59b1344fd04c9559af1129b4a4b7389df2 Mon Sep 17 00:00:00 2001 From: bd_ Date: Wed, 11 Oct 2023 19:29:07 +0900 Subject: [PATCH] wip --- docs-site~/src/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs-site~/src/index.js b/docs-site~/src/index.js index c9c94e2f..3ec8c62d 100644 --- a/docs-site~/src/index.js +++ b/docs-site~/src/index.js @@ -83,7 +83,17 @@ async function handleEvent(event) { } }); } else { - const page = await getAssetFromKV(event, options); + let page; + try { + page = await getAssetFromKV(event, options); + } catch (e) { + // Try adding .html + options.mapRequestToAsset = function(request) { + return new Request(url.toString() + ".html", defaultAssetKey); + }; + + page = await getAssetFromKV(event, options); + } // allow headers to be altered response = new Response(page.body, page);