From 57df76f873bdb7e794ec0c3d08cabf9bd6b29768 Mon Sep 17 00:00:00 2001 From: markthree <1801982702@qq.com> Date: Sat, 26 Aug 2023 15:00:10 +0800 Subject: [PATCH 1/2] fix(runtime/static): fix occasional 404, close #1638 --- src/runtime/static.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/runtime/static.ts b/src/runtime/static.ts index ee0e98ccce..298bfaaa6f 100644 --- a/src/runtime/static.ts +++ b/src/runtime/static.ts @@ -6,7 +6,6 @@ import { setResponseHeader, setResponseStatus, removeResponseHeader, - send, } from "h3"; import { decodePath, @@ -76,8 +75,7 @@ export default eventHandler((event) => { const ifNotMatch = getRequestHeader(event, "if-none-match") === asset.etag; if (ifNotMatch) { setResponseStatus(event, 304, "Not Modified"); - send(event, ""); - return; + return "" } const ifModifiedSinceH = getRequestHeader(event, "if-modified-since"); @@ -88,8 +86,7 @@ export default eventHandler((event) => { new Date(ifModifiedSinceH) >= mtimeDate ) { setResponseStatus(event, 304, "Not Modified"); - send(event, ""); - return; + return "" } if (asset.type && !getResponseHeader(event, "Content-Type")) { From e15adc1ac83325eb11cddb61070299e58c41a3a4 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 26 Aug 2023 07:08:39 +0000 Subject: [PATCH 2/2] chore: apply automated lint fixes --- src/runtime/static.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/static.ts b/src/runtime/static.ts index 298bfaaa6f..bacb58f6db 100644 --- a/src/runtime/static.ts +++ b/src/runtime/static.ts @@ -75,7 +75,7 @@ export default eventHandler((event) => { const ifNotMatch = getRequestHeader(event, "if-none-match") === asset.etag; if (ifNotMatch) { setResponseStatus(event, 304, "Not Modified"); - return "" + return ""; } const ifModifiedSinceH = getRequestHeader(event, "if-modified-since"); @@ -86,7 +86,7 @@ export default eventHandler((event) => { new Date(ifModifiedSinceH) >= mtimeDate ) { setResponseStatus(event, 304, "Not Modified"); - return "" + return ""; } if (asset.type && !getResponseHeader(event, "Content-Type")) {