From 0e5848ceea1df150b5914fbcc15f070a4d7cc8c5 Mon Sep 17 00:00:00 2001 From: cf-pages <80505777+cf-pages@users.noreply.github.com> Date: Wed, 18 Jan 2023 16:48:14 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0=E4=BA=86kv?= =?UTF-8?q?=E4=BD=86=E5=9B=BE=E7=89=87=E6=B2=A1=E6=9C=89=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/file/[id].js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/functions/file/[id].js b/functions/file/[id].js index 08bef61b0..be1922087 100644 --- a/functions/file/[id].js +++ b/functions/file/[id].js @@ -25,7 +25,7 @@ export async function onRequest(context) { // Contents of context object return response; } - if (typeof env.img_url == "undefined" || env.img_url == null || env.img_url == ""){ + if (typeof env.img_url == "undefined" || env.img_url == null || env.img_url == ""){}else{ //check the record from kv const record = await env.img_url.getWithMetadata(params.id); console.log("record") @@ -70,12 +70,13 @@ export async function onRequest(context) { // Contents of context object if(typeof apikey == "undefined" || apikey == null || apikey == ""){ if (typeof env.img_url == "undefined" || env.img_url == null || env.img_url == ""){ + console.log("Not enbaled KV") + + }else{ //add image to kv await env.img_url.put(params.id, "",{ metadata: { ListType: "None", Label: "None",TimeStamp: time }, }); - }else{ - console.log("Not enbaled KV") } }else{ @@ -85,7 +86,7 @@ export async function onRequest(context) { // Contents of context object console.log(moderate_data) console.log("---env.img_url---") console.log(env.img_url=="true") - if (typeof env.img_url == "undefined" || env.img_url == null || env.img_url == ""){ + if (typeof env.img_url == "undefined" || env.img_url == null || env.img_url == ""){}else{ //add image to kv await env.img_url.put(params.id, "",{ metadata: { ListType: "None", Label: moderate_data.rating_label,TimeStamp: time },