bug fixed
This commit is contained in:
@@ -25,7 +25,30 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||
},
|
||||
});
|
||||
|
||||
if (targetUser?.isPrivate) {
|
||||
if (!targetUser) {
|
||||
return res
|
||||
.setHeader("Content-Type", "text/plain")
|
||||
.status(400)
|
||||
.send("File inaccessible.");
|
||||
}
|
||||
|
||||
const isInAPublicCollection = await prisma.collection.findFirst({
|
||||
where: {
|
||||
["OR"]: [
|
||||
{ ownerId: targetUser.id },
|
||||
{
|
||||
members: {
|
||||
some: {
|
||||
userId: targetUser.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
isPublic: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (targetUser?.isPrivate && !isInAPublicCollection) {
|
||||
if (!userId) {
|
||||
return res
|
||||
.setHeader("Content-Type", "text/plain")
|
||||
|
||||
Reference in New Issue
Block a user