Skip to content

Commit

Permalink
update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ihsangan committed Jun 8, 2024
1 parent 7fc3ee9 commit f7c9a75
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,20 @@ async function serveResult(request) {
let dc = new URL(request.url).searchParams.get('decode')
let code = 200
let result = await callAPI(request)
/*if (result.name = undefined) {
result = {success:false,message:"Not found"}
}*/
if (result.name != undefined) {
if (result.success == false) {
code = 400
}
// result.name = replace(/\u002B/g, '%20')
result.name = result.name.replace(/\u002B/g, '%20')
if (dc == false) {
result = result
}
if (!dc || dc == true) {
result.name = decodeURIComponent(result.name)
}
} else if (result.name = undefined) {
result = {success:false,message:"Not found"}
}
let response = new Response(JSON.stringify(result), {
status: code,
headers: {
Expand Down

0 comments on commit f7c9a75

Please sign in to comment.