Skip to content

Commit

Permalink
修复添加了kv但图片没有记录的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cf-pages committed Jan 18, 2023
1 parent 86fb2bd commit 0e5848c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions functions/file/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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{
Expand All @@ -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 },
Expand Down

0 comments on commit 0e5848c

Please sign in to comment.