members with edit permission can now refresh preservation as well + bug fix

This commit is contained in:
daniel31x13
2024-09-12 15:30:15 -04:00
parent 8bb6e32bfa
commit aaf3590542
5 changed files with 58 additions and 36 deletions
@@ -96,9 +96,18 @@ export default async function updateLinkById(
},
});
if (oldLink && oldLink?.url !== data.url) {
if (
data.url &&
oldLink &&
oldLink?.url !== data.url &&
isValidUrl(data.url)
) {
await removeFiles(oldLink.id, oldLink.collectionId);
}
} else
return {
response: "Invalid URL.",
status: 401,
};
const updatedLink = await prisma.link.update({
where: {