fix: editing files that are owned by the current user again

This commit is contained in:
diced
2025-11-18 20:37:51 -08:00
parent b2db0c15a3
commit 771aa67673

View File

@@ -148,7 +148,8 @@ export default fastifyPlugin(
}); });
if (!file) return res.notFound(); if (!file) return res.notFound();
if (!canInteract(req.user.role, file.User?.role ?? 'USER')) return res.notFound(); if (req.user.id !== file.User?.id && !canInteract(req.user.role, file.User?.role ?? 'USER'))
return res.notFound();
const deletedFile = await prisma.file.delete({ const deletedFile = await prisma.file.delete({
where: { where: {