Don't include user emails in lookup by id endpoint
This commit is contained in:
parent
c187b6816b
commit
a3f65a397d
@ -33,10 +33,16 @@ export async function onRequestGet(context: RequestContext) {
|
||||
status: 403,
|
||||
});
|
||||
|
||||
let item = await context.env.DATA.get(`${types[type].prefix}${itemId}`);
|
||||
let item: {
|
||||
[k: string]: any;
|
||||
} | null = await context.env.DATA.get(`${types[type].prefix}${itemId}`, {
|
||||
type: "json",
|
||||
});
|
||||
|
||||
if (!item)
|
||||
item = await context.env.DATA.get(`closed${types[type].prefix}${itemId}`);
|
||||
item = await context.env.DATA.get(`closed${types[type].prefix}${itemId}`, {
|
||||
type: "json",
|
||||
});
|
||||
|
||||
if (
|
||||
type === "report" &&
|
||||
@ -49,7 +55,9 @@ export async function onRequestGet(context: RequestContext) {
|
||||
status: 409,
|
||||
});
|
||||
|
||||
return new Response(item ? item : '{"error":"Not found"}', {
|
||||
if (item) delete item.user?.email;
|
||||
|
||||
return new Response(item ? JSON.stringify(item) : '{"error":"Not found"}', {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user